rusackas commented on code in PR #42803:
URL: https://github.com/apache/superset/pull/42803#discussion_r3739709371


##########
superset/databases/utils.py:
##########
@@ -72,17 +73,37 @@ def get_table_metadata(database: Any, table: Table) -> 
TableMetadataResponse:
     :return: Dict table metadata ready for API response
     """
     keys = []
-    columns = database.get_columns(table)
-    primary_key = database.get_pk_constraint(table)
+    table_missing = False
+    try:
+        columns = database.get_columns(table)
+        primary_key = database.get_pk_constraint(table)
+        foreign_keys = get_foreign_keys_metadata(database, table)
+        indexes = get_indexes_metadata(database, table)
+        table_comment = database.get_table_comment(table)
+    except NoSuchTableError:
+        # SQLAlchemy 2.0's sqlite dialect raises NoSuchTableError from

Review Comment:
   It's tempting, but that sqlite 200-with-empty-payload response is 
pre-existing behavior — `test_get_invalid_table_table_metadata` already 
branches on `backend == "sqlite"` and asserts the empty-but-200 shape, so it 
predates this PR and isn't something 2.0 introduced. This PR is just restoring 
that existing contract after 2.0's sqlite dialect started raising 
`NoSuchTableError` where 1.4 silently returned empty results. Unifying sqlite 
onto the 422 path would be a real API behavior change (and could break anyone 
relying on the current 200), so I'd rather keep that as a separate, deliberate 
follow-up than fold it into a dependency-bump PR.



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

To unsubscribe, e-mail: [email protected]

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