-
Notifications
You must be signed in to change notification settings - Fork 17
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
SingleDB: UDTF that references objects from other schema of same DB encounters failure #26
Comments
It is a bit odd that Snowflake does not support it natively. I'll take a look in the next few days. As a quick fix on the current version, you may define a placeholder and use it in function body. For example: body: |-
SELECT sales_date,
first_name,
last_name,
AVG(sales)
FROM ${{ database }}.RAW.SALES
WHERE SALES_DATE = as_of_date
GROUP BY sales_date, first_name, last_name And set placeholder using extra CLI option:
|
I'll look into it next week when I get back from travel. Explicit |
@sindhuthirugnanam , please check version I've added automatic placeholder called Example usage: body: |-
SELECT sales_date,
first_name,
last_name,
AVG(sales)
FROM ${{ target_db }}.RAW.SALES
WHERE SALES_DATE = as_of_date
GROUP BY sales_date, first_name, last_name Also, I did some extra tests. It seems, only SQL FUNCTIONs are affected by this problem. VIEWs support short syntax for identifiers with only schema name and object name. |
While deploying UDTF in Single-DB mode, functions that references objects from other schema (not fully qualified with db name) of same database is failed during deployment (
apply
) .Eg: I want to deploy a function in DBO schema that references object from RAW schema (see sample UDTF below). I don't want to hard code the database name in the function body as it takes away the reusability of code in various environments like DEV, QA, STAGE, etc.. Is there any way you can include
USE DATABASE <db_name>
before deploying functions or part of Snowflake connection engine itself (by repurposing--target-db
option)Error:
Cannot perform SELECT. This session does not have a current database. Call 'USE DATABASE', or use a qualified name
SingleDB Command:
snowddl-singledb --show-sql --exclude-object-types SCHEMA --apply-replace-table --apply-unsafe --target-db TEST_DB apply
UDTF Definition:
The text was updated successfully, but these errors were encountered: