From 811de6dccbf55f9aecad3d6d8ee193b632719667 Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Tue, 24 Sep 2024 13:16:22 -0400 Subject: [PATCH] Rebase --- .github/workflows/python-integration.yml | 4 +-- .github/workflows/python-package-daily.yml | 6 ---- .github/workflows/python-package.yml | 6 ---- docs/postgres.rst | 2 +- examples/postgres.py | 2 +- src/shillelagh/backends/multicorn/db.py | 28 ++++++++++++++++--- .../backends/multicorn/dialects/base.py | 1 - 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/workflows/python-integration.yml b/.github/workflows/python-integration.yml index f2c8381d..ff95ddda 100644 --- a/.github/workflows/python-integration.yml +++ b/.github/workflows/python-integration.yml @@ -33,7 +33,7 @@ jobs: pip install -r requirements/test.txt - name: Start the Postgres service run: | - docker-compose -f postgres/docker-compose.yml up --build -d + docker compose -f postgres/docker-compose.yml up --build -d - name: Wait for Postgres to become available run: | until docker run --network container:postgres_postgres_1 postgres_postgres pg_isready -h postgres -p 5432 -U shillelagh --timeout=90; do sleep 10; done @@ -46,4 +46,4 @@ jobs: if: always() run: | docker logs postgres_postgres_1 - docker-compose -f postgres/docker-compose.yml down + docker compose -f postgres/docker-compose.yml down diff --git a/.github/workflows/python-package-daily.yml b/.github/workflows/python-package-daily.yml index a94a13a8..bd279d75 100644 --- a/.github/workflows/python-package-daily.yml +++ b/.github/workflows/python-package-daily.yml @@ -30,12 +30,6 @@ jobs: run: | python -m pip install --upgrade pip setuptools python -m pip install -e '.[testing]' - - name: Install multicorn2 - run: | - git clone https://github.com/pgsql-io/multicorn2.git - cd multicorn2 - git checkout v2.5 - pip install -e '.[testing]' - name: Test with pytest run: | pytest --cov-fail-under=100 --cov=src/shillelagh -vv tests/ --doctest-modules src/shillelagh --without-integration --without-slow-integration diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7e866a4d..4f008d91 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -31,12 +31,6 @@ jobs: run: | python -m pip install --upgrade pip setuptools python -m pip install -r requirements/test.txt - - name: Install multicorn2 - run: | - git clone https://github.com/pgsql-io/multicorn2.git - cd multicorn2 - git checkout v2.5 - pip install -r requirements/test.txt - name: Test with pytest run: | pre-commit run --all-files diff --git a/docs/postgres.rst b/docs/postgres.rst index 673df90e..c72880ae 100644 --- a/docs/postgres.rst +++ b/docs/postgres.rst @@ -18,6 +18,6 @@ The ``postgres/`` directory has a Docker configuration that can be used to test .. code-block:: bash - docker-compose up --build -d + docker compose up --build -d You should then be able to run the example script in `examples/postgres.py`_ to test that everything works. diff --git a/examples/postgres.py b/examples/postgres.py index b46a4599..de61b65c 100644 --- a/examples/postgres.py +++ b/examples/postgres.py @@ -9,7 +9,7 @@ Postgres with the extension and the Python packages. Just run: $ cd postgres/ - $ docker-compose up --build -d + $ docker compose up --build -d Then you can run this script. """ diff --git a/src/shillelagh/backends/multicorn/db.py b/src/shillelagh/backends/multicorn/db.py index d85e01aa..df826292 100644 --- a/src/shillelagh/backends/multicorn/db.py +++ b/src/shillelagh/backends/multicorn/db.py @@ -2,13 +2,13 @@ """ A DB API 2.0 wrapper. """ + import logging import re from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast from uuid import uuid4 import psycopg2 -from multicorn import ForeignDataWrapper, Qual, SortKey from psycopg2 import extensions from shillelagh.adapters.base import Adapter @@ -20,14 +20,12 @@ IntegrityError, InterfaceError, InternalError, - NotSupportedError, OperationalError, ProgrammingError, Warning, ) from shillelagh.lib import ( combine_args_kwargs, - deserialize, escape_identifier, find_adapter, serialize, @@ -46,7 +44,29 @@ Timestamp, TimestampFromTicks, ) -from shillelagh.typing import Row + +__all__ = [ + "DatabaseError", + "DataError", + "Error", + "IntegrityError", + "InterfaceError", + "InternalError", + "OperationalError", + "BINARY", + "DATETIME", + "NUMBER", + "ROWID", + "STRING", + "Binary", + "Date", + "DateFromTicks", + "Time", + "TimeFromTicks", + "Timestamp", + "TimestampFromTicks", + "Warning", +] apilevel = "2.0" threadsafety = 2 diff --git a/src/shillelagh/backends/multicorn/dialects/base.py b/src/shillelagh/backends/multicorn/dialects/base.py index 6b6829bd..e3ea9872 100644 --- a/src/shillelagh/backends/multicorn/dialects/base.py +++ b/src/shillelagh/backends/multicorn/dialects/base.py @@ -18,7 +18,6 @@ class Multicorn2Dialect(PGDialect_psycopg2): - """ A SQLAlchemy dialect for Shillelagh based on psycopg2 and multicorn2. """