sodadata / soda-sql

Soda SQL and Soda Spark have been deprecated and replaced by Soda Core. docs.soda.io/soda-core/overview.html
https://docs.soda.io/
Apache License 2.0
61 stars 17 forks source link

soda analyze fails on mssql-databases having objects containing white-space characters #171

Closed geertvanzoest closed 2 years ago

geertvanzoest commented 2 years ago

Describe the bug When targeting MS SQL Server and executing soda analyze on database objects containing white-space characters (like column name instead of column_name), the script dataset_analyzer.py throws an error about incorrect syntax: TypeError: SQLServerDialect.qualify_column_name() takes 2 positional arguments but 3 were given.

Log

soda analyze
  | 2.1.1
  | Analyzing warehouse.yml ...
  | Querying warehouse for tables
  | Directory tables already exists
  | Executing SQL query:
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE lower(table_schema)='staging'
  | SQL took 0:00:00.018998
  | Executing SQL query:
SELECT column_name, data_type, is_nullable
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'nav_r_Soort_Grex_u_dbo'
  | SQL took 0:00:00.001000
  | Exception: SQLServerDialect.qualify_column_name() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\sodasql\cli\cli.py", line 287, in analyze
    dataset_analyze_results = dataset_analyzer.analyze(warehouse, table_name)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\sodasql\dataset_analyzer.py", line 59, in analyze
    qualified_column_name = dialect.qualify_column_name(column_name, source_type)
TypeError: SQLServerDialect.qualify_column_name() takes 2 positional arguments but 3 were given
  | If you think this is a bug in Soda SQL, please open an issue athttps://github.com/sodadata/soda-sql/issues/new/choose

To Reproduce

  1. Have a Microsoft SQL Server instance with target database containing schema-objects (tables, columns) having white-space characters in their name.
  2. Configure warehouse.yml accordingly
  3. Run soda analyze

OS: Windows Server 2022, Windows 10 Enterprise 21H2 Python Version: 3.10.x Soda SQL Version: 2.1.1 Warehouse Type: Microsoft SQL Server 2019 (15.0.2080.9)