dpgaspar commented on a change in pull request #8280: [superset] Core
SQLAlchemy query refactor
URL:
https://github.com/apache/incubator-superset/pull/8280#discussion_r333402111
##########
File path: superset/views/core.py
##########
@@ -2290,10 +2288,15 @@ def sqllab_viz(self):
SqlaTable = ConnectorRegistry.sources["table"]
data = json.loads(request.form.get("data"))
table_name = data.get("datasourceName")
- table =
db.session.query(SqlaTable).filter_by(table_name=table_name).first()
+ database_id = data.get("dbId")
+ table = (
+ db.session.query(SqlaTable)
+ .filter_by(database_id=database_id, table_name=table_name)
+ .one_or_none()
+ )
Review comment:
@john-bodley regarding #5449 I'm assuming here that the unique constraint is
`database_id, table_name`. It seemed strange to me having the `first` call on
`table_name` only. Anyway does #5449 need a change here also?
----------------------------------------------------------------
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]