Skip to main content

ADBC (Arrow Database Connectivity) driver for Apache Spark Connect

Project description

adbc-driver-spark (Python)

Apache Arrow ADBC driver for Apache Spark Connect.

It lets you run SQL against a Spark Connect server and get results back as Apache Arrow, with a standard ADBC and DBAPI 2.0 (PEP 249) interface. The package bundles a native shared library built from Go, so there is no JVM and no PySpark dependency.

Install

pip install adbc-driver-spark

Optional extras: adbc-driver-spark[pandas] for fetch_df(), adbc-driver-spark[polars] for Polars output.

Quickstart (DBAPI 2.0)

import adbc_driver_spark.dbapi as dbapi

with dbapi.connect("sc://localhost:15002") as conn:
    with conn.cursor() as cur:
        cur.execute("SELECT id, id * 2 AS doubled FROM range(5)")
        print(cur.fetchall())
        # Arrow / pandas in one shot:
        cur.execute("SELECT * FROM range(1000)")
        table = cur.fetch_arrow_table()   # pyarrow.Table
        df = cur.fetch_df()               # pandas.DataFrame (needs [pandas])

Connect to a secured server with a bearer token (TLS is implied):

conn = dbapi.connect("sc://my-host:443", token="my-jwt-token")

Low level ADBC

import adbc_driver_spark

db = adbc_driver_spark.connect(
    "sc://localhost:15002",
    db_kwargs={adbc_driver_spark.DatabaseOptions.USER_AGENT.value: "my-app/1.0"},
)
db.close()

Options

See adbc_driver_spark.DatabaseOptions. Everything that can go in the connection string (sc://host:port/;token=...;use_ssl=true) can also be passed via db_kwargs.

Development

The native library libadbc_driver_spark.{so,dylib,dll} must sit inside the adbc_driver_spark/ package directory (or on the loader path) at runtime. From a source checkout:

make python-dev      # builds the Go shared lib, copies it into the package,
                     # and `pip install -e python`
pytest python/tests  # unit tests run without a server; integration tests
                     # are skipped unless SPARK_CONNECT_URI is set

See the project documentation for the full guide.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adbc_driver_spark-0.3.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

adbc_driver_spark-0.3.0-py3-none-win_amd64.whl (6.6 MB view details)

Uploaded Python 3Windows x86-64

adbc_driver_spark-0.3.0-py3-none-manylinux_2_34_x86_64.whl (6.8 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

adbc_driver_spark-0.3.0-py3-none-manylinux_2_34_aarch64.whl (6.2 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ ARM64

adbc_driver_spark-0.3.0-py3-none-macosx_15_0_x86_64.whl (6.5 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

adbc_driver_spark-0.3.0-py3-none-macosx_14_0_arm64.whl (6.0 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file adbc_driver_spark-0.3.0.tar.gz.

File metadata

  • Download URL: adbc_driver_spark-0.3.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for adbc_driver_spark-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a36d5ea1772c0f5b69b34112dee600eb8fed9cfbb016605c1fda6fe0d5e6ca58
MD5 cac49ac135a7d4add792cd2e4c6b92da
BLAKE2b-256 75edff6144e559f5011dc8ec0a24fcd7685ce806f53aaa2ee7168aa0dc0905d9

See more details on using hashes here.

File details

Details for the file adbc_driver_spark-0.3.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for adbc_driver_spark-0.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 139c5fa9d2f56d0a9f9621271b34a7bed600ea29837ca90db3a5737486d56608
MD5 de097ec98847ccb0d786f708f7094107
BLAKE2b-256 efbbbf310398f682083906410afb3656828a0c24137d104a2166db22ac67c33b

See more details on using hashes here.

File details

Details for the file adbc_driver_spark-0.3.0-py3-none-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for adbc_driver_spark-0.3.0-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d0aea98bfa425d802b8bcb2dfae0dba5f9d1d1f730e3241e6b043cd318d1212d
MD5 39569641025e04093bbcfeb812a037d0
BLAKE2b-256 a3d718224264169b46ad8c21c88b6290b2f7326ec254a4cea3247f6b784d10c3

See more details on using hashes here.

File details

Details for the file adbc_driver_spark-0.3.0-py3-none-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for adbc_driver_spark-0.3.0-py3-none-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 170de4f5df157aabc59d843a19a23289dac79548d17be2c8cbd05a91d6879970
MD5 f14e3c20a3c0a76fdfc1247da630820c
BLAKE2b-256 5cd8013d04aff4292a2471cba8171d2e6f978717e97f5f393c3a4fd859529bdb

See more details on using hashes here.

File details

Details for the file adbc_driver_spark-0.3.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for adbc_driver_spark-0.3.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 9d6fdedc5b8bdc5affb9cd2a8e89812b50cbaee97c1c7c16e3e1769d4a6b1d99
MD5 ea0ce2cdf83b6e70374300bc4048a07c
BLAKE2b-256 3fecfb39511acb0663991360943d776ec0a809e191d1ee8e58da3bdb1b7d84d4

See more details on using hashes here.

File details

Details for the file adbc_driver_spark-0.3.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for adbc_driver_spark-0.3.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 70b75a6cdfd7c322b3a1605bfaa037bcd3b64be02d44cb14128e83888c1a2cd5
MD5 6befced0040b42a021a23d92fba517f7
BLAKE2b-256 123153c1ff2c3f18f6eda66dc78d1dee730e5b1cd360b6a7b25730c2c7a51de9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page