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

CI: Fix installation of defined SQLAlchemy version, bringing back SA13 #492

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ jobs:
# Bootstrap environment.
source bootstrap.sh

# Report about the test matrix slot.
echo "Invoking tests with CrateDB ${CRATEDB_VERSION} and SQLAlchemy ${SQLALCHEMY_VERSION}"

# Invoke validation tasks.
flake8 src bin
coverage run bin/test -vv1
Expand Down
9 changes: 9 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ function setup_package() {
# Install package in editable mode.
pip install --editable='.[sqlalchemy,test,doc]'

# Install designated SQLAlchemy version.
if [ -n "${SQLALCHEMY_VERSION}" ]; then
if [ "${SQLALCHEMY_VERSION}" = "latest" ]; then
pip install "sqlalchemy" --upgrade
else
pip install "sqlalchemy==${SQLALCHEMY_VERSION}"
fi
fi

}

function run_buildout() {
Expand Down
14 changes: 0 additions & 14 deletions devtools/setup_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ function main() {
echo "Environment variable 'CRATEDB_VERSION' needed"
exit 1
}
[ -z ${SQLALCHEMY_VERSION} ] && {
echo "Environment variable 'SQLALCHEMY_VERSION' needed"
exit 1
}

# Let's go.
echo "Invoking tests with CrateDB ${CRATEDB_VERSION} and SQLAlchemy ${SQLALCHEMY_VERSION}"

# Install designated SQLAlchemy version.
if [ ${SQLALCHEMY_VERSION} = "latest" ]; then
pip install "sqlalchemy" --upgrade
else
pip install "sqlalchemy==${SQLALCHEMY_VERSION}"
fi

# Replace CrateDB version.
if [ ${CRATEDB_VERSION} = "nightly" ]; then
Expand Down
6 changes: 5 additions & 1 deletion src/crate/client/sqlalchemy/tests/compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import sqlalchemy as sa
from sqlalchemy.sql import update, text

from crate.client.sqlalchemy.sa_version import SA_VERSION, SA_1_4
from crate.client.sqlalchemy.types import Craty


Expand Down Expand Up @@ -77,7 +78,10 @@ def test_select_with_offset(self):
self.metadata.bind = self.crate_engine
selectable = self.mytable.select().offset(5)
statement = str(selectable.compile())
self.assertEqual(statement, "SELECT mytable.name, mytable.data \nFROM mytable\n LIMIT ALL OFFSET ?")
if SA_VERSION >= SA_1_4:
self.assertEqual(statement, "SELECT mytable.name, mytable.data \nFROM mytable\n LIMIT ALL OFFSET ?")
else:
self.assertEqual(statement, "SELECT mytable.name, mytable.data \nFROM mytable \n LIMIT ALL OFFSET ?")

def test_select_with_limit(self):
"""
Expand Down