Skip to content

Column of type UUID reflected as NullType #681

@edgarrmondragon

Description

@edgarrmondragon

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    3.13.13

  2. What operating system and processor architecture are you using?

    macOS-26.4.1-arm64-arm-64bit-Mach-O

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

    asn1crypto==1.5.1
    boto3==1.43.2
    botocore==1.43.2
    certifi==2026.4.22
    cffi==2.0.0
    charset-normalizer==3.4.7
    cryptography==47.0.0
    filelock==3.29.0
    idna==3.13
    jmespath==1.1.0
    packaging==26.2
    platformdirs==4.9.6
    pycparser==3.0
    pyjwt==2.12.1
    pyopenssl==26.1.0
    python-dateutil==2.9.0.post0
    python-dotenv==1.2.2
    pytz==2026.1.post1
    requests==2.33.1
    s3transfer==0.17.0
    six==1.17.0
    snowflake-connector-python==4.4.0
    snowflake-sqlalchemy==1.9.0
    sortedcontainers==2.4.0
    sqlalchemy==2.0.49
    tomlkit==0.14.0
    typing-extensions==4.15.0
    urllib3==2.6.3

  4. What did you do?

    import os
    
    from dotenv import load_dotenv
    from sqlalchemy import create_engine, select, text, Table, MetaData
    from snowflake.sqlalchemy import URL
    
    
    def main():
        load_dotenv(override=True)
    
        url = URL(
            account=os.environ["SNOWFLAKE_ACCOUNT"],
            database=os.environ["SNOWFLAKE_DATABASE"],
            schema="PUBLIC",
            user=os.environ["SNOWFLAKE_USERNAME"],
            password=os.environ["SNOWFLAKE_PASSWORD"],
        )
        engine = create_engine(url)
    
        with engine.begin() as conn:
            conn.execute(text("CREATE OR REPLACE TABLE sample_uuid_table(uuid_col UUID)"))
            conn.execute(text("INSERT INTO sample_uuid_table VALUES ('c73d9175-0a1d-48c6-8d30-df165461328b')"))
    
        meta = MetaData()
        sample = Table("sample_uuid_table", meta, autoload_with=engine)
        col = sample.columns["uuid_col"]
        print(f"{col.type=}")
    
        with engine.begin() as conn:
            data = conn.execute(select(sample))
    
        record = data.fetchone()
        print(record)
    
    
    if __name__ == "__main__":
        main()

    which outputs

    $ uv run python main.py
    /repro/snowflake-uuid/.venv/lib/python3.14/site-packages/snowflake/sqlalchemy/snowdialect.py:567: SAWarning: Did not recognize type 'UUID' of column 'uuid_col'
      sa_util.warn(
    col.type=NullType()
    ('c73d9175-0a1d-48c6-8d30-df165461328b',)
  5. What did you expect to see?

    No warning, not a NullType, and a native python uuid.UUID instance in the record.

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

    import logging
    import os
    
    for logger_name in ['snowflake.sqlalchemy', 'snowflake.connector']:
       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)
    

    That results in almost 1000 log lines...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions