john-bodley commented on a change in pull request #5449: [schema] Updating the
tables schema
URL:
https://github.com/apache/incubator-superset/pull/5449#discussion_r333135968
##########
File path: superset/connectors/sqla/models.py
##########
@@ -304,7 +306,11 @@ class SqlaTable(Model, BaseDatasource):
owner_class = security_manager.user_model
__tablename__ = "tables"
- __table_args__ = (UniqueConstraint("database_id", "table_name"),)
+
+ # Note this unqiuness constraint is not part of the physicalschema, i.e.,
it doesn't
+ # exist in the migrations, but is required by `import_from_dict` to ensure
the
+ # correct filters are applied in order to identify uniqueness.
+ __table_args__ = (UniqueConstraint("database_id", "schema", "table_name"),)
Review comment:
@mistercrunch I'm really not a fan of this but the
[import_from_dict](https://github.com/apache/incubator-superset/blob/648f9fa54b90ce4cca84737a21214fd92c0e9fcc/superset/models/helpers.py#L110)
method uses the uniqueness constraint add add additionally filters to match
the relevant record in the database.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]