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

Step "SQL Query" | Using environment variables #230

Open
bernabeudario opened this issue Feb 2, 2025 · 1 comment
Open

Step "SQL Query" | Using environment variables #230

bernabeudario opened this issue Feb 2, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@bernabeudario
Copy link
Contributor

Hi,

In Step “SQL Query” I configured the query to use an environment variable:

SELECT * FROM input_df1
WHERE Fecha = '{os.environ["ENV_DATE"]}'

I press the button “Export to Python code” and I see:

sqlQuery1 = duckdb.query("""SELECT * FROM inlineInput1
WHERE Fecha = f'{os.environ["ENV_DATE"]}'""").to_df().convert_dtypes()

Which causes an error and the variable is not replaced:

Catalog Error: Type with name f does not exist!
Did you mean "float"?

You should get something like:

sqlQuery1 = duckdb.query(f"""SELECT * FROM inlineInput1
WHERE Fecha = '{os.environ["ENV_DATE"]}'""").to_df().convert_dtypes()

SQLQuery_Using_environment_variables.zip

Attached pipeline.

Regards

@tgourdel
Copy link
Contributor

tgourdel commented Feb 5, 2025

Thanks @bernabeudario, I was able to reproduce

@tgourdel tgourdel added the bug Something isn't working label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants