betodealmeida opened a new issue #11028:
URL: https://github.com/apache/incubator-superset/issues/11028
When importing a dashboard from the `examples` database to a database with a
different name, the import fails.
### Expected results
Import should complete.
### Actual results
```
sqlalchemy.exc.InvalidRequestError: This Session's transaction has been
rolled back due to a previous exception during flush. To begin a new
transaction with this Session, first issue Session.rollback(). Original
exception was: (sqlite3.IntegrityError) UNIQUE constraint failed:
tables.table_name
[SQL: INSERT INTO tables (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,
created_by_fk, changed_by_fk) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?)]
[parameters: ('2020-09-23 12:44:36.044830', '2020-09-23 12:44:36.044837',
None, None, 0, 0, 0, None, '{"remote_id": 4, "database_name": "examples",
"import_time": 1600890276}', None, None, 'unicode_test', 'dttm', '3', None,
None, None, 0, None, 2, 2)]
(Background on this error at: http://sqlalche.me/e/13/gkpj) (Background on
this error at: http://sqlalche.me/e/13/7s2a)
```
#### How to reproduce the bug
0. Set `PREVENT_UNSAFE_DB_CONNECTIONS` to false.
1. Create a new database called `examples 2`, using the same SQLAlchemy
connection string as the `examples` database.
2. Export the "Unicode test" dashboard from `examples`.
3. Import the dashboard into the `examples 2` database.
### Environment
- superset version: SHA: e4e78b66
- python version: 3.8.5
- node.js version: v14.11.0
- npm version: 6.14.8
### Checklist
Make sure these boxes are checked 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
N/A
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]