Skip to content

Commit

Permalink
Switch to new SQLAlchemy dialect for CrateDB
Browse files Browse the repository at this point in the history
This includes the fix to the `get_table_names()` reflection method.
  • Loading branch information
amotl committed Dec 22, 2023
1 parent 0f39ebd commit 500e343
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 40 deletions.
34 changes: 0 additions & 34 deletions cratedb_toolkit/sqlalchemy/patch.py

This file was deleted.

4 changes: 2 additions & 2 deletions cratedb_toolkit/util/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def import_csv_pandas(
Import CSV data using pandas.
"""
import pandas as pd
from crate.client.sqlalchemy.support import insert_bulk
from sqlalchemy_cratedb.support import insert_bulk

df = pd.read_csv(filepath)
with self.engine.connect() as connection:
Expand All @@ -234,7 +234,7 @@ def import_csv_dask(
"""
import dask.dataframe as dd
import pandas as pd
from crate.client.sqlalchemy.support import insert_bulk
from sqlalchemy_cratedb.support import insert_bulk

# Set a few defaults.
npartitions = npartitions or os.cpu_count()
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ dependencies = [
"colorama<1",
"colorlog",
"crash",
"crate[sqlalchemy]>=0.34",
"croud==1.8",
'importlib-metadata; python_version <= "3.7"',
"python-dotenv<2",
"sqlalchemy",
"sqlalchemy-cratedb@ git+https://github.com/crate-workbench/sqlalchemy-cratedb.git@amo/fix-inspector",
"sqlparse<0.5",
]
[project.optional-dependencies]
Expand Down
2 changes: 0 additions & 2 deletions tests/sqlalchemy/test_patch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sqlalchemy as sa

from cratedb_toolkit.sqlalchemy import patch_inspector
from tests.conftest import TESTDRIVE_DATA_SCHEMA


Expand Down Expand Up @@ -32,7 +31,6 @@ def test_inspector_patched(database):
This verifies that it still works, when it properly has been assigned to
the `?schema=` connection string URL parameter.
"""
patch_inspector()
tablename = f'"{TESTDRIVE_DATA_SCHEMA}"."foobar"'
inspector: sa.Inspector = sa.inspect(database.engine)
database.run_sql(f"CREATE TABLE {tablename} AS SELECT 1")
Expand Down

0 comments on commit 500e343

Please sign in to comment.