Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure MSSQL Backend (and possibly others) Broken SQLAlchemy Engine objects interactions with pandas.read_sql() #4066

Open
peter-resnick opened this issue Apr 2, 2024 · 2 comments

Comments

@peter-resnick
Copy link

peter-resnick commented Apr 2, 2024

Expected Behavior

feast cli commands like feast plan work when using a mssql offline store

Current Behavior

Currently, repos with mssql offline store are broken when appying feast cli commands. The following occurs:

  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/feast/repo_operations.py", line 218, in plan
    data_source.validate(store.config)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/feast/infra/offline_stores/contrib/mssql_offline_store/mssqlserver_source.py", line 215, in validate
    self.get_table_column_names_and_types(config)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/feast/infra/offline_stores/contrib/mssql_offline_store/mssqlserver_source.py", line 243, in get_table_column_names_and_types
    table_schema = pandas.read_sql(columns_query, conn)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/io/sql.py", line 706, in read_sql
    return pandas_sql.read_query(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/io/sql.py", line 2736, in read_query
    cursor = self.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/io/sql.py", line 2670, in execute
    cur = self.con.cursor()
AttributeError: 'Engine' object has no attribute 'cursor'

Steps to reproduce

with a feature store YAML of:

project: myproject
provider: azure
registry:
  registry_type: sql
  path: ${SQL_REGISTRY_CONNECTION_STRING}
offline_store: 
  type: mssql
  connection_string: ${SQL_OFFLINE_CONNECTION_STRING}
online_store:
  type: redis
  redis_type: redis_cluster
  connection_string: ${REDIS_CONNECTION_STRING}
entity_key_serialization_version: 2

when we run feast plan - we get the above errors.

This may impact other providers, but I've only confirmed it with azure provider

Specifications

  • Version: 0.35.0
  • Platform: Mac + Linux (probably others)
  • Subsystem:

Possible Solution

I think this is a really a SQLAlchemy versioning issue, I resolved the problem by pinning
SQLAlchemy<1.4.52

If we just update the AZURE_REQUIRED to:

AZURE_REQUIRED = [
    "azure-storage-blob>=0.37.0",
    "azure-identity>=1.6.1",
    "SQLAlchemy>=1.4.19,<1.4.52",
    "pyodbc>=4.0.30",
    "pymssql",
] 

I think we'd avoid this issue

@peter-resnick
Copy link
Author

I can make a PR for this when I get a chance

@tokoko
Copy link
Collaborator

tokoko commented Apr 4, 2024

@peter-resnick mssql is still not part of ci, so unfortunately these sort of bugs may occur. I don't think pinning sqlalchemy is an option though, we recently merged an upgrade to 2.x #4065

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants