youngyjd closed pull request #5936: [WIP] add schema to unique constraint
URL: https://github.com/apache/incubator-superset/pull/5936
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/connectors/sqla/models.py 
b/superset/connectors/sqla/models.py
index 037eb779a0..b137f80a9f 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -262,7 +262,7 @@ class SqlaTable(Model, BaseDatasource):
     column_class = TableColumn
 
     __tablename__ = 'tables'
-    __table_args__ = (UniqueConstraint('database_id', 'table_name'),)
+    __table_args__ = (UniqueConstraint('database_id', 'schema', 'table_name'),)
 
     table_name = Column(String(250))
     main_dttm_col = Column(String(250))
diff --git 
a/superset/migrations/versions/d6a223d2332a_add_one_more_constraint.py 
b/superset/migrations/versions/d6a223d2332a_add_one_more_constraint.py
new file mode 100644
index 0000000000..6dd8d0acf5
--- /dev/null
+++ b/superset/migrations/versions/d6a223d2332a_add_one_more_constraint.py
@@ -0,0 +1,25 @@
+"""add one more constraint
+
+Revision ID: d6a223d2332a
+Revises: 55e910a74826
+Create Date: 2018-09-19 16:51:55.900887
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'd6a223d2332a'
+down_revision = '55e910a74826'
+
+from alembic import op
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.create_unique_constraint(None, 'tables', ['database_id', 'schema', 
'table_name'])
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_constraint(None, 'tables', type_='unique')
+    # ### end Alembic commands ###


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]

Reply via email to