@@ -406,10 +406,11 @@ def _schema_aware_fuzzy_column_resolve(
406
406
return default_col_name
407
407
408
408
# Optimize the statement + qualify column references.
409
- logger .debug (
410
- "Prior to column qualification sql %s" ,
411
- statement .sql (pretty = True , dialect = dialect ),
412
- )
409
+ if logger .isEnabledFor (logging .DEBUG ):
410
+ logger .debug (
411
+ "Prior to column qualification sql %s" ,
412
+ statement .sql (pretty = True , dialect = dialect ),
413
+ )
413
414
try :
414
415
# Second time running qualify, this time with:
415
416
# - the select instead of the full outer statement
@@ -434,7 +435,8 @@ def _schema_aware_fuzzy_column_resolve(
434
435
raise SqlUnderstandingError (
435
436
f"sqlglot failed to map columns to their source tables; likely missing/outdated table schema info: { e } "
436
437
) from e
437
- logger .debug ("Qualified sql %s" , statement .sql (pretty = True , dialect = dialect ))
438
+ if logger .isEnabledFor (logging .DEBUG ):
439
+ logger .debug ("Qualified sql %s" , statement .sql (pretty = True , dialect = dialect ))
438
440
439
441
# Handle the create DDL case.
440
442
if is_create_ddl :
@@ -805,7 +807,7 @@ def _sqlglot_lineage_inner(
805
807
logger .debug ("Parsing lineage from sql statement: %s" , sql )
806
808
statement = parse_statement (sql , dialect = dialect )
807
809
808
- original_statement = statement .copy ()
810
+ original_statement , statement = statement , statement .copy ()
809
811
# logger.debug(
810
812
# "Formatted sql statement: %s",
811
813
# original_statement.sql(pretty=True, dialect=dialect),
0 commit comments