Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI incorrectly parses schema containing "." character #698

Open
Vfisa opened this issue May 19, 2023 · 3 comments
Open

CLI incorrectly parses schema containing "." character #698

Vfisa opened this issue May 19, 2023 · 3 comments

Comments

@Vfisa
Copy link

Vfisa commented May 19, 2023

In my case I have tried with this schema:
in.c-data-diff-prep
resulted in this error:
Screenshot 2023-05-18 at 11 22 32

@ctiml
Copy link
Member

ctiml commented May 23, 2023

@Vfisa Thank you for filing the issue. We can reproduce it and will try to fix it.

for internal tracking: sc-31444

@popcornylu
Copy link
Contributor

This issue is a bit more complicated than we expect.

We use the SQLAlchemy library at the underlying level to connect to databases and data warehouses. In the Snowflake engine, we have tried various approaches but have been unable to retrieve table metadata from a schema that contains dots in its name. Below is an very simple example

from sqlalchemy import create_engine
import urllib.parse

account = '<account>'
user = '<user>'
password = '<password>'
database = '<database>'
schema = 'DBT.TEST'
# schema = '"DBT.TEST"'  
warehouse = '<warehouse>' 

connection_string = f'snowflake://{user}:{password}@{account}/{database}'
if schema:
    connection_string += f'?schema={urllib.parse.quote(schema)}'
if warehouse:
    connection_string += f'&warehouse={warehouse}'


engine = create_engine(connection_string)

query the columns in a table.

from sqlalchemy import Table, MetaData
Table("mytable", MetaData(), autoload_with=engine, schema=schema)

We will investigate the same issue in sqlalchemy+duckdb, to see if it is sqlalchemy issue or snowflake-sqlalchemy

@popcornylu
Copy link
Contributor

Related issue
snowflakedb/snowflake-sqlalchemy#448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants