sadpandajoe commented on code in PR #37557:
URL: https://github.com/apache/superset/pull/37557#discussion_r2794903711
##########
superset/examples/generic_loader.py:
##########
@@ -194,6 +247,7 @@ def create_generic_loader(
sample_rows: Optional[int] = None,
data_file: Optional[Any] = None,
schema: Optional[str] = None,
+ uuid: Optional[str] = None,
) -> Callable[[Database, SqlaTable], None]:
Review Comment:
Not applicable — this PR was rebased to a test-only scope. The source code
changes to `generic_loader.py` are no longer part of this PR (the production
fix was merged in PR #37577).
##########
superset/examples/generic_loader.py:
##########
@@ -163,17 +212,21 @@ def safe_serialize(x: Any, column_name: str) ->
Optional[str]:
logger.info("Loaded %d rows into %s", len(pdf), table_name)
- # Create or update SqlaTable metadata
- tbl = (
- db.session.query(SqlaTable)
- .filter_by(table_name=table_name, database_id=database.id)
- .first()
- )
+ # Create or update SqlaTable metadata using UUID-first lookup
+ tbl, found_by_uuid = _find_dataset(table_name, database.id, uuid, schema)
if not tbl:
tbl = SqlaTable(table_name=table_name, database_id=database.id)
- # Set the database reference
tbl.database = database
+ tbl.schema = schema
+
+ # Backfill UUID if found by table_name (not UUID) and UUID not set
+ if uuid and not tbl.uuid and not found_by_uuid:
+ tbl.uuid = uuid
+
+ # Backfill schema if existing table has no schema set
+ if schema and not tbl.schema:
+ tbl.schema = schema
Review Comment:
Not applicable — this PR was rebased to a test-only scope. The source code
changes to `generic_loader.py` are no longer part of this PR (the production
fix was merged in PR #37577).
--
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]