You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use sqlalchemy.func.sysdate in a query or table definition. For example, here is an alembic migration that creates a column with sysdate() as a default value:
2022-05-12T17:12:24Z DEBUG snowflake.connector.ssl_wrap_socket Injecting ssl_wrap_socket_with_ocsp
2022-05-12T17:12:24Z DEBUG snowflake.connector.auth cache directory: /root/.cache/snowflake
2022-05-12T17:12:24Z DEBUG snowflake.connector.cursor Failed to import pyarrow. Cannot use pandas fetch API
2022-05-12T17:12:24Z INFO alembic.runtime.migration Context impl SnowflakeImpl.
2022-05-12T17:12:24Z INFO alembic.runtime.migration Generating static SQL
2022-05-12T17:12:24Z INFO alembic.runtime.migration Will assume non-transactional DDL.
2022-05-12T17:12:24Z INFO alembic.runtime.migration Running upgrade 57e74ce2b6a3 -> 4f93cae7a47b, create table
-- Running upgrade 57e74ce2b6a3 -> 4f93cae7a47b
CREATE TABLE test_table (
created datetime NOT NULL DEFAULT sysdate
);
UPDATE alembic_version SET version_num='4f93cae7a47b' WHERE alembic_version.version_num = '57e74ce2b6a3';
This occurs because SQLAlchemy implements sysdate as an AnsiFunction. Based on this discussion with a SQLAlchemy maintainer, the dialect should implement an override with the correct behavior.
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
sqlalchemy.func.sysdate() does not render parentheses
SNOW-589556: sqlalchemy.func.sysdate() does not render parentheses
May 12, 2022
To clean up and re-prioritize bugs and feature requests we are closing all issues older than 6 months as of Apr 1, 2023. If there are any issues or feature requests that you would like us to address, please re-create them. For urgent issues, opening a support case with this link Snowflake Community is the fastest way to get a response
What version of Python are you using?
Python 3.7.13
What operating system and processor architecture are you using?
Linux-5.4.0-109-generic-x86_64-with-debian-10.12
What are the component versions in the environment (
pip freeze
)?Note: our environment has a lot of packages installed, so I dumped the relevant parts using
pipdeptree
:Use
sqlalchemy.func.sysdate
in a query or table definition. For example, here is an alembic migration that creates a column withsysdate()
as a default value:The generated SQL calls
sysdate
without the parentheses. This leads to an error becausesysdate
requires the parentheses (documentation).This occurs because SQLAlchemy implements
sysdate
as anAnsiFunction
. Based on this discussion with a SQLAlchemy maintainer, the dialect should implement an override with the correct behavior.The text was updated successfully, but these errors were encountered: