Проблема
При проверке столбцов в таблицах Snowflake с помощью SQLAlchemy комментарии к столбцам не отображаются.
Требования
pip install snowflake-sqlalchemy
Тест
import sqlalchemy
# set up the connection
snowflake_conn = '<your-connection-string-here>'
engine = sqlalchemy.create_engine(snowflake_conn)
# create a table for testing, add a column comment
engine.execute('create table public.test ("col1" text);')
engine.execute("""alter table public.test alter "col1" comment 'this is my comment'""")
# check if comment is successfully stored in the information schema
engine.execute("select comment from information_schema.columns where table_name='TEST'").fetchall()
# Output: [('this is my comment',)]
# now let's try to inspect the table
inspector = sqlalchemy.inspect(engine)
inspector.get_columns('TEST', schema='PUBLIC')
Фактический результат
[{'name': 'col1',
'type': VARCHAR(length=16777216),
'nullable': True,
'default': None,
'autoincrement': False,
'primary_key': False}]
Ожидаемый результат
[{'name': 'col1',
'type': VARCHAR(length=16777216),
'nullable': True,
'default': None,
'comment': 'this is my comment', # <-- this is added
'autoincrement': False,
'primary_key': False}]
Вопрос
Я что-то не так проверяю для комментариев к колонкам или это просто ошибка в снежинке-sqlalchemy?