Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Soda SQL analyze looks for tables in different schemas #344

Open
albinkjellin opened this issue Apr 26, 2022 · 0 comments
Open

Soda SQL analyze looks for tables in different schemas #344

albinkjellin opened this issue Apr 26, 2022 · 0 comments
Labels
bug Something isn't working soda-sql

Comments

@albinkjellin
Copy link

Describe the bug
When running analyze Soda SQL does seem to disregard the schema. When comparing the implementation of SQL Server with postgres it seems to be missing the schema part.

This is from postgres:

def sql_columns_metadata_query(self, table_name: str) -> str:
        sql = (f"SELECT column_name, data_type, is_nullable \n"
               f"FROM information_schema.columns \n"
               f"WHERE lower(table_name) = '{table_name}'")
        if self.database:
            sql += f" \n  AND table_catalog = '{self.database}'"
        if self.schema:
            sql += f" \n  AND table_schema = '{self.schema}'"
        return sql

Compared to SQL Server:

 def sql_columns_metadata_query(self, table_name: str) -> str:
        sql = (f"SELECT column_name, data_type, is_nullable \n"
               f"FROM INFORMATION_SCHEMA.COLUMNS \n"
               f"WHERE TABLE_NAME = '{table_name}'")
        return sql

This seems to explain the issue.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new test in scan.yml
  2. Run soda scan ...
    3 ...

Context
Include your scan.yml or warehouse.yml when relevant

OS:
Python Version:
Soda SQL Version:
Warehouse Type:

@albinkjellin albinkjellin added bug Something isn't working soda-sql labels Apr 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working soda-sql
Projects
None yet
Development

No branches or pull requests

1 participant