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
NOW() is not recognized as equivalent to now() when used as a default value, even though SQL is case-insensitive.
To Reproduce
Given the following SQL:
ddl="""CREATE TABLE asdf ( t TIMESTAMP DEFAULT NOW());"""print(omymodels.create_models(ddl=ddl, models_type="dataclass")["code"])
The output is
importdatetimefromdataclassesimportdataclass@dataclassclassAsdf:
t: datetime.datetime='NOW()'# Default value is wrong
Note that, while the datatype of the column is correct, the default value is a string instead of a call to datetime.datetime.now(). If we make NOW()` lowercase, we get the expected output.
Describe the bug
NOW()
is not recognized as equivalent tonow()
when used as a default value, even though SQL is case-insensitive.To Reproduce
Given the following SQL:
The output is
Note that, while the datatype of the column is correct, the default value is a string instead of a call to
datetime.datetime.now(). If we make
NOW()` lowercase, we get the expected output.n.b. the expected output has a bug in it which I'll file a separate ticket for
Expected behavior
SQL is case-insensitive, therefore
now()
andNOW()
should behave identically and produce the same output.Additional context
Python: 3.8.2
Version: 0.8.1
The text was updated successfully, but these errors were encountered: