ariga / atlas-provider-sqlalchemy

Apache License 2.0
18 stars 3 forks source link

Supporting SQLAlchemy Core and old versions of SQLAlchemy #14

Closed vshender closed 6 months ago

vshender commented 6 months ago

When trying to use atlas-provider-sqlalchemy, a number of problems were identified:

  1. The provider only supports SQLAlchemy ORM models, not SQLAlchemy Core tables.

  2. During its work the provider imports files with models, which means that the dependencies that the project requires must be installed (e.g. pgvector-python), which means it's easiest to run the provider in the virtual environment of the project itself. At the same time, the provider has a specific version of SQLAlchemy in its dependencies, which may not be compatible with the version of the library used by the project.

(We at PandaDoc have encountered both of these problems because we use SQLAlchemy Core and the SQLAlchemy version is 1.4).

This pull request attempts to solve both of these problems as follows:

  1. Added support for SQLAlchemy Core tables.

  2. Added support for different versions of SQLAlchemy. To do this, SQLAlchemy was removed from the atlas-provider-sqlalchemy dependencies (implying that the SQLAlchemy version of the project for which the provider will run will be used) and the code was rewritten so that the provider works with SQLAlchemy versions 1.2, 1.3, 1.4, and 2.0. Tox is used for testing all these versions.

  3. Small cosmetic changes have also been made (consistent using of quotes, not exiting from the library code and throwing exceptions instead, etc.)

vshender commented 6 months ago

I'm sorry, I don't know why one of the integration tests is failing. I didn't make any changes that could cause one integration test to fail while the others passed, so I suspect the problem is not with the pull request.

ronenlu commented 6 months ago

@vshender Thank you for your contribution! You are right, the reason the integration test is failing is not the PR, its because it requires repo secret to run. Since your PR is from forked repo that doesnt contain the required secret, the test fails.

ronenlu commented 6 months ago

@vshender You can download the latest release: https://pypi.org/project/atlas-provider-sqlalchemy/