Skip to content
Closed
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
7 changes: 5 additions & 2 deletions by-dataframe/pandas/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
click<9
colorlog<7
crate>=2.1.2
crate>=2.1.2,<2.2
pandas>=2.3,<3.1
pueblo>=0.0.18
sqlalchemy-cratedb[all] @ git+https://github.com/crate-workbench/sqlalchemy-cratedb@amo/postgresql-async
sqlalchemy-cratedb[all]<0.43
Comment on lines -3 to +6

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will limit versions here for now, so that subsequent Dependabot submissions will show us when things might go south.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# Needed for async support.
# sqlalchemy-cratedb[all] @ git+https://github.com/crate-workbench/sqlalchemy-cratedb@amo/postgresql-async
9 changes: 9 additions & 0 deletions by-dataframe/pandas/test_read.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import shlex
import subprocess

import pytest


def run(command: str):
subprocess.check_call(shlex.split(command))


def test_read_standard():
cmd = "time python read_pandas.py --dburi=crate://crate@localhost:4200"
run(cmd)


@pytest.mark.skip("Needs https://github.com/crate/sqlalchemy-cratedb/pull/11")
def test_read_urllib3():
cmd = "time python read_pandas.py --dburi=crate+urllib3://crate@localhost:4200"
run(cmd)


@pytest.mark.skip("Needs https://github.com/crate/sqlalchemy-cratedb/pull/11")
def test_read_psycopg3():
cmd = "time python read_pandas.py --dburi=crate+psycopg://crate@localhost:5432"
run(cmd)
10 changes: 7 additions & 3 deletions by-language/python-sqlalchemy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
click<9
colorlog<7
crate>=2.1.2
crate>=2.1.2,<2.2
pueblo>=0.0.18
sqlalchemy>=2.0.49,<2.1
sqlalchemy-cratedb[all] @ git+https://github.com/crate-workbench/sqlalchemy-cratedb@amo/postgresql-async
sqlalchemy>=2.0.49
sqlalchemy-cratedb[all]<0.43

# Needed for async support.
# sqlalchemy-cratedb[all] @ git+https://github.com/crate-workbench/sqlalchemy-cratedb@amo/postgresql-async
greenlet
7 changes: 5 additions & 2 deletions by-language/python-sqlalchemy/sync_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def engine(self):
"""
Provide an SQLAlchemy engine object.
"""
return sa.create_engine(self.dsn, isolation_level="AUTOCOMMIT", echo=True)
# TODO: Add `isolation_level="AUTOCOMMIT"` with sqlalchemy-cratedb >= 0.43
return sa.create_engine(self.dsn, echo=True)

@property
@lru_cache
Expand Down Expand Up @@ -149,7 +150,9 @@ def run_example(dsn: str):

def run_drivers(drivers: t.List[str]):
for driver in drivers:
if driver == "urllib3":
if driver == "cratedb":
dsn = "crate://localhost:4200/"
elif driver == "urllib3":
dsn = "crate+urllib3://localhost:4200/doc"
elif driver == "psycopg":
dsn = "crate+psycopg://crate@localhost:5432/doc"
Expand Down
10 changes: 9 additions & 1 deletion by-language/python-sqlalchemy/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,24 @@ def test_insert_efficient_unknown(capfd):
assert "ValueError: Unknown variant: unknown" in err


def test_sync_table():
def test_sync_table_standard():
cmd = "time python sync_table.py cratedb"
run(cmd)


@pytest.mark.skip("PostgreSQL support is experimental")
def test_sync_table_advanced():
cmd = "time python sync_table.py urllib3 psycopg"
run(cmd)


@pytest.mark.skip("Async support is experimental")
def test_async_table():
cmd = "time python async_table.py psycopg asyncpg"
run(cmd)


@pytest.mark.skip("Async support is experimental")
def test_async_streaming():
cmd = "time python async_streaming.py psycopg asyncpg"
run(cmd)