-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
22 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import uuid | ||
|
||
import sqlglot | ||
from sqlglot import parse_one | ||
|
||
from universql.plugins.snow import TableSampleUniversqlPlugin, SnowflakeStageUniversqlPlugin | ||
from universql.plugins.snow import SnowflakeStageUniversqlPlugin | ||
from universql.protocol.session import UniverSQLSession | ||
from universql.warehouse.duckdb import DuckDBExecutor, DuckDBCatalog | ||
from universql.warehouse.snowflake import SnowflakeExecutor, SnowflakeCatalog | ||
|
||
one = sqlglot.parse_one("select 1", dialect="snowflake") | ||
compute = {"warehouse": None} | ||
session = UniverSQLSession( | ||
{'account': 'dhb43249.us-east-1', | ||
'cache_directory': '/Users/bkabak/.universql/cache', | ||
'catalog': 'snowflake', | ||
'home_directory': '/Users/bkabak'}, uuid.uuid4(), {"warehouse": "duckdb()"}, {}) | ||
compute = {"warehouse": "duckdb()"} | ||
{'account': 'dhb43249.us-east-1', 'catalog': 'snowflake'}, uuid.uuid4(), {"warehouse": "duckdb()"}, {}) | ||
plugin = SnowflakeStageUniversqlPlugin(SnowflakeExecutor(SnowflakeCatalog(session, compute))) | ||
sql = (parse_one("select * from @stagename", dialect="snowflake") | ||
sql = (parse_one("copy into table_name FROM @stagename/test", dialect="snowflake") | ||
.transform(plugin.transform_sql, DuckDBExecutor(DuckDBCatalog(session, compute)))) | ||
print(sql.sql(dialect="duckdb")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters