Skip to content

Commit

Permalink
Warnings are already captured
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Nov 28, 2024
1 parent 217efb3 commit 1939947
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions singer_sdk/connectors/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,24 +908,17 @@ def discover_catalog_entry(

# Initialize columns list
table_schema = th.PropertiesList()
with warnings.catch_warnings(record=True) as inspection_warnings:
for column_def in inspected.get_columns(table_name, schema=schema_name):
column_name = column_def["name"]
is_nullable = column_def.get("nullable", False)
jsonschema_type: dict = self.to_jsonschema_type(column_def["type"])
table_schema.append(
th.Property(
name=column_name,
wrapped=th.CustomType(jsonschema_type),
required=not is_nullable,
),
)
if len(inspection_warnings) > 0:
for line in inspection_warnings:
expanded_msg: str = (
f"Discovery warning: {line.message} in '{unique_stream_id}'"
)
self.logger.info(expanded_msg)
for column_def in inspected.get_columns(table_name, schema=schema_name):
column_name = column_def["name"]
is_nullable = column_def.get("nullable", False)
jsonschema_type: dict = self.to_jsonschema_type(column_def["type"])
table_schema.append(
th.Property(
name=column_name,
wrapped=th.CustomType(jsonschema_type),
required=not is_nullable,
),
)
schema = table_schema.to_dict()

sql_datatypes = {}
Expand Down

0 comments on commit 1939947

Please sign in to comment.