snowflakedb / snowflake-sqlalchemy

Snowflake SQLAlchemy
https://pypi.python.org/pypi/snowflake-sqlalchemy/
Apache License 2.0
232 stars 152 forks source link

SNOW-343335: Why is `get_columns()` implemented as a select from information schema instead of more performant `describe` #221

Closed bastienboutonnet closed 1 year ago

bastienboutonnet commented 3 years ago

I am curious as to why get_columns() implements using a select query from the info schema (https://github.com/snowflakedb/snowflake-sqlalchemy/blob/e1141b8ddfbc499d1b813ae1b791a0559312e6cb/snowdialect.py#L403) while describe table would get us the same kind of info.

I see that at some point in the past your implementation was using describe (https://github.com/snowflakedb/snowflake-sqlalchemy/pull/33/files#diff-8a3053a35fc794b288420f7343bfbc575c18bc834c223c2aae201e0adcfdd5c0R455) so I am curious what is the reason why this was changed.

It seems like this issue also talks about a related topic: https://github.com/snowflakedb/snowflake-sqlalchemy/issues/204 but there doesn't seem to be any resolution or conclusion on it.

I am asking because I personally would like to use describe instead and therefore re-implement get_columns() but I'd rather check with you if I am missing something and the reason why you resort to an ultimately less performant implementation.

**The questions below are irrelevant for this issue***

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using (python --version)?

  2. What operating system and processor architecture are you using (python -c 'import platform; print(platform.platform())')?

  3. What are the component versions in the environment (pip list)?

  4. What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good.

  5. What did you expect to see?

  6. What did you see instead?

  7. Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ['snowflake.sqlalchemy', 'snowflake.connector', 'botocore']: 
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)
github-actions[bot] commented 1 year ago

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