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

Remove SQLAlchemy dialect #616

Merged
merged 1 commit into from
Jun 18, 2024
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
11 changes: 3 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
jobs:

analyze:
name: "Analyze with SQLAlchemy ${{ matrix.sqla-version }}"
name: "Analyze Python code"
runs-on: ubuntu-latest
permissions:
actions: read
Expand All @@ -28,9 +28,7 @@ jobs:

strategy:
fail-fast: false
matrix:
language: [ python ]
sqla-version: ['<1.4', '<1.5', '<2.1']
language: [ python ]

steps:
- name: Checkout
Expand All @@ -57,10 +55,7 @@ jobs:

- name: Install project
run: |
pip install --editable=.[sqlalchemy,test]
pip install "sqlalchemy${{ matrix.sqla-version }}" --upgrade --pre
pip install --editable=.[test]

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}/sqla-version:${{ matrix.sqla-version }}"
16 changes: 1 addition & 15 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
jobs:
nightly:
name: "Python: ${{ matrix.python-version }}
SQLA: ${{ matrix.sqla-version }}
CrateDB: ${{ matrix.cratedb-version }}
on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
Expand All @@ -18,23 +17,11 @@ jobs:
os: ['ubuntu-latest']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
cratedb-version: ['nightly']
sqla-version: ['latest']
pip-allow-prerelease: ['false']

# Another CI test matrix slot to test against prerelease versions of Python packages.
include:
- os: 'ubuntu-latest'
python-version: '3.12'
cratedb-version: 'nightly'
sqla-version: 'latest'
pip-allow-prerelease: 'true'

fail-fast: false

env:
CRATEDB_VERSION: ${{ matrix.cratedb-version }}
SQLALCHEMY_VERSION: ${{ matrix.sqla-version }}
PIP_ALLOW_PRERELEASE: ${{ matrix.pip-allow-prerelease }}

steps:
- uses: actions/checkout@v4
Expand All @@ -55,11 +42,10 @@ jobs:
source bootstrap.sh

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

# Run linter.
flake8 src bin

# Run tests.
export SQLALCHEMY_WARN_20=1
bin/test -vvv
16 changes: 1 addition & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ concurrency:
jobs:
test:
name: "Python: ${{ matrix.python-version }}
SQLA: ${{ matrix.sqla-version }}
on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
cratedb-version: ['5.4.5']
sqla-version: ['<1.4', '<1.5', '<2.1']
pip-allow-prerelease: ['false']

# To save resources, only use the most recent Python versions on macOS.
exclude:
Expand All @@ -35,20 +32,10 @@ jobs:
- os: 'macos-latest'
python-version: '3.10'

# Another CI test matrix slot to test against prerelease versions of Python packages.
include:
- os: 'ubuntu-latest'
python-version: '3.12'
cratedb-version: '5.4.5'
sqla-version: 'latest'
pip-allow-prerelease: 'true'

fail-fast: false

env:
CRATEDB_VERSION: ${{ matrix.cratedb-version }}
SQLALCHEMY_VERSION: ${{ matrix.sqla-version }}
PIP_ALLOW_PRERELEASE: ${{ matrix.pip-allow-prerelease }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

steps:
Expand All @@ -70,13 +57,12 @@ jobs:
source bootstrap.sh

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

# Run linter.
flake8 src bin

# Run tests.
export SQLALCHEMY_WARN_20=1
coverage run bin/test -vvv

# Set the stage for uploading the coverage report.
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Changes for crate
Unreleased
==========

- The SQLAlchemy dialect has been split off into the `sqlalchemy-cratedb`_
package. See `Migrate from crate.client to sqlalchemy-cratedb`_ to learn
about necessary migration steps.

.. _Migrate from crate.client to sqlalchemy-cratedb: https://cratedb.com/docs/sqlalchemy-cratedb/migrate-from-crate-client.html
.. _sqlalchemy-cratedb: https://pypi.org/project/sqlalchemy-cratedb/


2024/01/18 0.35.2
=================
Expand Down
2 changes: 0 additions & 2 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ Run all tests::

Run specific tests::

./bin/test -vvvv -t SqlAlchemyCompilerTest
./bin/test -vvvv -t test_score
./bin/test -vvvv -t sqlalchemy

Ignore specific test directories::

Expand Down
14 changes: 1 addition & 13 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

# Default variables.
CRATEDB_VERSION=${CRATEDB_VERSION:-5.2.2}
SQLALCHEMY_VERSION=${SQLALCHEMY_VERSION:-<2.1}


function print_header() {
Expand Down Expand Up @@ -71,16 +70,7 @@ function setup_package() {
fi

# Install package in editable mode.
pip install ${PIP_OPTIONS} --editable='.[sqlalchemy,test]'

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

}

Expand All @@ -93,8 +83,6 @@ function finalize() {
# Some steps before dropping into the activated virtualenv.
echo
echo "Sandbox environment ready"
echo -n "Using SQLAlchemy version: "
python -c 'import sqlalchemy; print(sqlalchemy.__version__)'
echo

}
Expand Down
27 changes: 2 additions & 25 deletions docs/by-example/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ By example
##########

This part of the documentation enumerates different kinds of examples how to
use the CrateDB Python client.


DB API, HTTP, and BLOB interfaces
=================================
use the CrateDB Python DBAPI HTTP client for standards-based database
conversations, and the proprietary BLOB interfaces.

The examples in this section are all about CrateDB's `Python DB API`_ interface,
the plain HTTP API interface, and a convenience interface for working with
Expand All @@ -27,24 +24,4 @@ methods, and behaviors of the ``Connection`` and ``Cursor`` objects.
blob


.. _sqlalchemy-by-example:

SQLAlchemy by example
=====================

The examples in this section are all about CrateDB's `SQLAlchemy`_ dialect, and
its corresponding API interfaces, see also :ref:`sqlalchemy-support`.

.. toctree::
:maxdepth: 1

sqlalchemy/getting-started
sqlalchemy/crud
sqlalchemy/working-with-types
sqlalchemy/advanced-querying
sqlalchemy/inspection-reflection
sqlalchemy/dataframe


.. _Python DB API: https://peps.python.org/pep-0249/
.. _SQLAlchemy: https://www.sqlalchemy.org/
Loading