john-bodley commented on a change in pull request #9882:
URL: 
https://github.com/apache/incubator-superset/pull/9882#discussion_r430019707



##########
File path: superset/connectors/sqla/models.py
##########
@@ -373,7 +373,11 @@ class SqlaTable(Model, BaseDatasource):
     owner_class = security_manager.user_model
 
     __tablename__ = "tables"
-    __table_args__ = (UniqueConstraint("database_id", "table_name"),)
+    __table_args__ = (
+        UniqueConstraint(
+            "database_id", "schema", "table_name", 
name="_customer_location_uc",
+        ),
+    )

Review comment:
       I don't think this is a viable solution based on how different engine 
treat uniqueness for nullable columns (`schema` in this case). This is 
documented in https://github.com/apache/incubator-superset/pull/5449 which is 
an open PR from over two years ago but was updated last year to remedy the 
nullable issue. Though it's not perfect, i.e., ideally the constraint should 
reside within the database model I sense it's the only viable solution unless 
we special case the various engines.




----------------------------------------------------------------
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]

Reply via email to