You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/10/12 08:00:27 UTC
[GitHub] [superset] ul-fra opened a new issue #17072: Cannot create two datasets based on tables with the same name
ul-fra opened a new issue #17072:
URL: https://github.com/apache/superset/issues/17072
I have an AWS Athena/Glue datacatalog. This catalog contains several databases, e.g. db-a and db-b. Both of these two databases contain a table "te_general". When I create a dataset for db-a.te_general everything is fine but when I create the second dataset based on db-b.te_general I get the error message "An error occurred while creating datasets: Dataset could not be created.".
In the logs I can find this message: "(sqlite3.IntegrityError) UNIQUE constraint failed: tables.table_name"
So it seems that the table_name seems to be unique. I would expect that the tripple of database-schema-table needs to be unique.
#### How to reproduce the bug
1. Go to datasets and create a first dataset for schema A and table T
2. Go to datasets and create a second dataset for schema B and table T
### Expected results
Both dataset should be registered.
### Actual results
Second dataset is not created.
#### Screenshots
### Environment
- browser type and version: Firefox 88.0
- superset version: Superset 0.0.0dev
- python version: Python 3.8.12
- node.js version: ? (docker exec -it superset node -v --> node not on path)
- any feature flags active: no
### Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [x] I have reproduced the issue with at least the latest released version of superset.
- [x] I have checked the issue tracker for the same issue and I haven't found one similar.
### Additional context
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] mloyanich edited a comment on issue #17072: Cannot create two datasets based on tables with the same name
Posted by GitBox <gi...@apache.org>.
mloyanich edited a comment on issue #17072:
URL: https://github.com/apache/superset/issues/17072#issuecomment-996362098
This issue occurs only for SQLite DB. The functionality works fine with PostgreSQL.
As SQLite is going to be decommissioned, I don't think it's worthy to fix this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] mloyanich commented on issue #17072: Cannot create two datasets based on tables with the same name
Posted by GitBox <gi...@apache.org>.
mloyanich commented on issue #17072:
URL: https://github.com/apache/superset/issues/17072#issuecomment-986282140
I have the same issue. It will also fail if you have different databases with the same table name, no matter what's the schema
attaching Superset log:
```
2021-12-05 10:36:47,253:DEBUG:superset.models.core:Database.get_sqla_engine(). Masked URL: postgresql+psycopg2://postgres:XXXXXXXXXX@database-connection-details:5432/postgres
2021-12-05 10:36:53,947:WARNING:superset.datasets.commands.create:(raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
(sqlite3.IntegrityError) UNIQUE constraint failed: tables.table_name
[SQL: INSERT INTO tables (uuid, created_on, changed_on, description, default_endpoint, is_featured, filter_select_enabled, "offset", cache_timeout, params, perm, schema_perm, table_name, main_dttm_col, database_id, fetch_values_predicate, schema, sql, is_sqllab_view, template_params, extra, created_by_fk, changed_by_fk) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
[parameters: (<memory at 0x121789880>, '2021-12-05 10:36:53.947410', '2021-12-05 10:36:53.947417', None, None, 0, 0, 0, None, None, None, None, 'new_table', None, 3, None, 'public', None, 0, None, None, 1, 1)]
(Background on this error at: http://sqlalche.me/e/13/gkpj)
Traceback (most recent call last):
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
cursor.execute(statement, parameters)
sqlite3.IntegrityError: UNIQUE constraint failed: tables.table_name
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "SUPERSET_LOCATION/superset/superset/datasets/commands/create.py", line 51, in run
dataset.fetch_metadata(commit=False)
File "SUPERSET_LOCATION/superset/superset/connectors/sqla/models.py", line 1527, in fetch_metadata
old_columns_by_name: Dict[str, TableColumn] = {
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3534, in __iter__
self.session._autoflush()
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1633, in _autoflush
util.raise_(e, with_traceback=sys.exc_info()[2])
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1622, in _autoflush
self.flush()
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2540, in flush
self._flush(objects)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2682, in _flush
transaction.rollback(_capture_exception=True)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2642, in _flush
flush_context.execute()
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
rec.execute(self)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute
persistence.save_obj(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 239, in save_obj
_emit_insert_statements(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1135, in _emit_insert_statements
result = cached_connections[connection].execute(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
return meth(self, multiparams, params)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
ret = self._execute_context(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
self._handle_dbapi_exception(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
util.raise_(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
(sqlite3.IntegrityError) UNIQUE constraint failed: tables.table_name
[SQL: INSERT INTO tables (uuid, created_on, changed_on, description, default_endpoint, is_featured, filter_select_enabled, "offset", cache_timeout, params, perm, schema_perm, table_name, main_dttm_col, database_id, fetch_values_predicate, schema, sql, is_sqllab_view, template_params, extra, created_by_fk, changed_by_fk) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
[parameters: (<memory at 0x121789880>, '2021-12-05 10:36:53.947410', '2021-12-05 10:36:53.947417', None, None, 0, 0, 0, None, None, None, None, 'new_table', None, 3, None, 'public', None, 0, None, None, 1, 1)]
(Background on this error at: http://sqlalche.me/e/13/gkpj)
2021-12-05 10:36:53,965:ERROR:superset.datasets.api:Error creating model DatasetRestApi: Dataset could not be created.
Traceback (most recent call last):
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
cursor.execute(statement, parameters)
sqlite3.IntegrityError: UNIQUE constraint failed: tables.table_name
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "SUPERSET_LOCATION/superset/superset/datasets/commands/create.py", line 51, in run
dataset.fetch_metadata(commit=False)
File "SUPERSET_LOCATION/superset/superset/connectors/sqla/models.py", line 1527, in fetch_metadata
old_columns_by_name: Dict[str, TableColumn] = {
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 3534, in __iter__
self.session._autoflush()
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1633, in _autoflush
util.raise_(e, with_traceback=sys.exc_info()[2])
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1622, in _autoflush
self.flush()
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2540, in flush
self._flush(objects)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2682, in _flush
transaction.rollback(_capture_exception=True)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2642, in _flush
flush_context.execute()
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
rec.execute(self)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute
persistence.save_obj(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 239, in save_obj
_emit_insert_statements(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1135, in _emit_insert_statements
result = cached_connections[connection].execute(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
return meth(self, multiparams, params)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
ret = self._execute_context(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
self._handle_dbapi_exception(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
util.raise_(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "SUPERSET_LOCATION/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
(sqlite3.IntegrityError) UNIQUE constraint failed: tables.table_name
[SQL: INSERT INTO tables (uuid, created_on, changed_on, description, default_endpoint, is_featured, filter_select_enabled, "offset", cache_timeout, params, perm, schema_perm, table_name, main_dttm_col, database_id, fetch_values_predicate, schema, sql, is_sqllab_view, template_params, extra, created_by_fk, changed_by_fk) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
[parameters: (<memory at 0x121789880>, '2021-12-05 10:36:53.947410', '2021-12-05 10:36:53.947417', None, None, 0, 0, 0, None, None, None, None, 'new_table', None, 3, None, 'public', None, 0, None, None, 1, 1)]
(Background on this error at: http://sqlalche.me/e/13/gkpj)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "SUPERSET_LOCATION/superset/superset/datasets/api.py", line 252, in post
new_model = CreateDatasetCommand(g.user, item).run()
File "SUPERSET_LOCATION/superset/superset/datasets/commands/create.py", line 65, in run
raise DatasetCreateFailedError() from ex
superset.datasets.commands.exceptions.DatasetCreateFailedError: Dataset could not be created.
2021-12-05 10:36:53,981:DEBUG:superset.stats_logger:[stats_logger] (incr) DatasetRestApi.post.error
2021-12-05 10:36:53,982:DEBUG:superset.stats_logger:[stats_logger] (timing) DatasetRestApi.post.time | 6880.805107
2021-12-05 10:36:53,982:INFO:werkzeug:127.0.0.1 - - [05/Dec/2021 10:36:53] "POST /api/v1/dataset/ HTTP/1.1" 422 -
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] mloyanich commented on issue #17072: Cannot create two datasets based on tables with the same name
Posted by GitBox <gi...@apache.org>.
mloyanich commented on issue #17072:
URL: https://github.com/apache/superset/issues/17072#issuecomment-996362098
This issue occurs only for SQLite DB.
As SQLite is going to be decommissioned, I don't think it's worthy to fix this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org