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

ImportError: cannot import name 'DeclarativeBase' from 'sqlalchemy.orm' #1514

Open
1 of 3 tasks
bsce20007 opened this issue Jan 14, 2025 · 2 comments
Open
1 of 3 tasks

Comments

@bsce20007
Copy link

Apache Iceberg version

0.8.1 (latest release)

Please describe the bug 🐞

I’m facing an issue where PyIceberg’s usage of SQLAlchemy 2.x is causing compatibility problems with Apache Airflow, which only supports SQLAlchemy 1.4.x. Specifically, I’m getting an ImportError: cannot import name 'DeclarativeBase' from 'sqlalchemy.orm' when running a DAG that uses PyIceberg. This issue occurs because PyIceberg expects SQLAlchemy 2.x, but I’m forced to use SQLAlchemy 1.4.x for compatibility with Airflow. Any advice on resolving this conflict or workarounds to make PyIceberg work with SQLAlchemy 1.4.x while maintaining Airflow functionality would be greatly appreciated.

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time
@kevinjqliu
Copy link
Contributor

Airflow. Any advice on resolving this conflict or workarounds to make PyIceberg work with SQLAlchemy 1.4.x while maintaining Airflow functionality would be greatly appreciated.

I think you would either have to change Airflow or PyIceberg.

You might be able to change PyIceberg to use SQLAlchemy 1.x but I'm not sure if it'll be compatible. Historically, we have been using 2.x https://github.com/apache/iceberg-python/pulls?q=is%3Apr+SQLAlchemy+is%3Aclosed

Otherwise you might have to upgrade Airflow to align with PyIceberg

@jayceslesar
Copy link
Contributor

Looks like airflow is slated to use 2.x in 3.0 release apache/airflow#39593

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

No branches or pull requests

3 participants