SNOW-638840: Version 1.4.0 breaks SnowflakeDialect._get_schema_columns function when column of type DATE exists in schema
See original GitHub issuePlease answer these questions before submitting your issue. Thanks!
- What version of Python are you using?
Python 3.8.13 (default, Apr 18 2022, 15:19:59)
[Clang 13.1.6 (clang-1316.0.21.2.3)]
- What operating system and processor architecture are you using?
macOS-12.4-arm64-arm-64bit
- What are the component versions in the environment (
pip freeze
)?
asn1crypto==1.5.1
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.0.12
cryptography==36.0.2
idna==3.3
oscrypto==1.3.0
pycparser==2.21
pycryptodomex==3.15.0
PyJWT==2.4.0
pyOpenSSL==22.0.0
pytz==2022.1
requests==2.28.1
snowflake-connector-python==2.7.9
snowflake-sqlalchemy==1.4.0
SQLAlchemy==1.4.39
urllib3==1.26.10`
- What did you do?
The following code will reproduce the issue when using a schema that has a column of type DATE:
from snowflake.sqlalchemy import URL
from sqlalchemy import create_engine, MetaData
engine = create_engine(URL(
account = '####',
user = '####',
password = '####',
database = '####',
schema = '####',
warehouse = '####',
role='####',
))
meta = MetaData()
meta.reflect(bind=engine)
- What did you expect to see?
The above code should execute successfully as it does with the previous version 1.3.4.
- Can you set logging to DEBUG and collect the logs?
Error traceback:
/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/snowflake/sqlalchemy/snowdialect.py:539: SAWarning: Did not recognize type 'DATE' of column 'applicationdate'
sa_util.warn(
Traceback (most recent call last):
File "test2.py", line 16, in <module>
meta.reflect(bind=engine)
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/sql/schema.py", line 4887, in reflect
Table(name, self, **reflect_opts)
File "<string>", line 2, in __new__
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
return fn(*args, **kwargs)
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/sql/schema.py", line 616, in __new__
metadata._remove_table(name, schema)
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
compat.raise_(
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 208, in raise_
raise exception
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/sql/schema.py", line 611, in __new__
table._init(name, metadata, *args, **kw)
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/sql/schema.py", line 686, in _init
self._autoload(
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/sql/schema.py", line 721, in _autoload
conn_insp.reflect_table(
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/engine/reflection.py", line 774, in reflect_table
for col_d in self.get_columns(
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/engine/reflection.py", line 497, in get_columns
col_defs = self.dialect.get_columns(
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/snowflake/sqlalchemy/snowdialect.py", line 680, in get_columns
schema_columns = self._get_schema_columns(connection, schema, **kw)
File "<string>", line 2, in _get_schema_columns
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/sqlalchemy/engine/reflection.py", line 55, in cache
ret = fn(self, con, *args, **kw)
File "/Users/enriquerodicio/Development/snowflake-python-test/venv/lib/python3.8/site-packages/snowflake/sqlalchemy/snowdialect.py", line 555, in _get_schema_columns
type_instance = col_type(**col_type_kw)
TypeError: 'NullType' object is not callable
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Choose the right date function - Microsoft Support
Display a date or time in a specific format · Split a date or time into parts · Turn numbers and text into...
Read more >Date & Time Data Types - Snowflake Documentation
This topic describes the data types supported in Snowflake for managing dates, times, and timestamps (combined date + time). It also describes the...
Read more >Exploring Postgres date formats and their different functions
In this article, we will explore Postgres dates, the different date data types, uses and functions. Date and timestamps are helpful for data ......
Read more >Time series / date functionality — pandas 1.5.2 documentation
Series and DataFrame have extended data type support and functionality for datetime , timedelta and Period data when passed into those constructors.
Read more >11.2.2 The DATE, DATETIME, and TIMESTAMP Types
MySQL recognizes DATE , DATETIME , and TIMESTAMP values in several formats, ... The DATE type is used for values with a date...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hey guys, apologize for the issue here – as pointed out by @daniel-sali , it’s because of the
DATE
has been accidentally removed from theischema_names
map while the change isn’t detected by the tests.sorry about causing you trouble and appreciate your help on identifying the issue, we will fix this and ship a new release.
thanks for your patience, we have released 1.4.1 which fixed the issue. please upgrade to the latest one and take a try. I’m closing the issue now, feel free to reach out if you’re still encountering the issue or see other issues.