Skip to main content

Arrow, pydantic style

Project description

Welcome to arrowdantic

Arrowdantic is a small Python library backed by a mature Rust implementation of Apache Arrow that can interoperate with

For simple (but data-heavy) data engineering tasks, this package essentially replaces pyarrow: it supports reading from and writing to Parquet, Arrow at the same or higher performance and higher safety (e.g. no segfaults).

Furthermore, it supports reading from and writing to ODBC compliant databases at the same or higher performance than turbodbc.

This package is also suitable for environments such as AWS Lambda functions. It takes 13M of disk space, compared to 82M taken by pyarrow.

Features

  • declare and access Arrow-backed arrays (integers, floats, boolean, string, binary)
  • read from and write to Apache Arrow IPC file
  • read from and write to Apache Parquet
  • read from and write to ODBC-compliant databases (e.g. postgres, mongoDB)

Examples

Use parquet

import io
import arrowdantic as ad

original_arrays = [ad.UInt32Array([1, None])]

schema = ad.Schema(
    [ad.Field(f"c{i}", array.type, True) for i, array in enumerate(original_arrays)]
)

data = io.BytesIO()
with ad.ParquetFileWriter(data, schema) as writer:
    writer.write(ad.Chunk(original_arrays))
data.seek(0)

reader = ad.ParquetFileReader(data)
chunk = next(reader)
assert chunk.arrays() == original_arrays

Use Arrow files

import arrowdantic as ad

original_arrays = [ad.UInt32Array([1, None])]

schema = ad.Schema(
    [ad.Field(f"c{i}", array.type, True) for i, array in enumerate(original_arrays)]
)

import io

data = io.BytesIO()
with ad.ArrowFileWriter(data, schema) as writer:
    writer.write(ad.Chunk(original_arrays))
data.seek(0)

reader = ad.ArrowFileReader(data)
chunk = next(reader)
assert chunk.arrays() == original_arrays

Use ODBC

import arrowdantic as ad


arrays = [ad.Int32Array([1, None]), ad.StringArray(["aa", None])]

with ad.ODBCConnector(r"Driver={SQLite3};Database=sqlite-test.db") as con:
    # create an empty table with a schema
    con.execute("DROP TABLE IF EXISTS example;")
    con.execute("CREATE TABLE example (c1 INT, c2 TEXT);")

    # insert the arrays
    con.write("INSERT INTO example (c1, c2) VALUES (?, ?)", ad.Chunk(arrays))

    # read the arrays
    with con.execute("SELECT c1, c2 FROM example", 1024) as chunks:
        assert chunks.fields() == [
            ad.Field("c1", ad.DataType.int32(), True),
            ad.Field("c2", ad.DataType.string(), True),
        ]
        chunk = next(chunks)
assert chunk.arrays() == arrays

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

arrowdantic-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distributions

arrowdantic-0.1.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.9 MB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

arrowdantic-0.1.0-cp310-none-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

arrowdantic-0.1.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

arrowdantic-0.1.0-cp310-cp310-macosx_10_7_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.10 macOS 10.7+ x86-64

arrowdantic-0.1.0-cp39-none-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9 Windows x86-64

arrowdantic-0.1.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

arrowdantic-0.1.0-cp39-cp39-macosx_10_7_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.9 macOS 10.7+ x86-64

arrowdantic-0.1.0-cp38-none-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.8 Windows x86-64

arrowdantic-0.1.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

arrowdantic-0.1.0-cp38-cp38-macosx_10_7_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.8 macOS 10.7+ x86-64

arrowdantic-0.1.0-cp37-none-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.7 Windows x86-64

arrowdantic-0.1.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

arrowdantic-0.1.0-cp37-cp37m-macosx_10_7_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

File details

Details for the file arrowdantic-0.1.0.tar.gz.

File metadata

  • Download URL: arrowdantic-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for arrowdantic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3438ec15b1a6e138b612b969ca5a8ab946357f07ffea55e558655acc23a05b0f
MD5 15b4cdcf5f10b955e4bb0dc95ac0b3c6
BLAKE2b-256 64d402c66380615d020cc5f8664301e270c09b2a1d6ff120b9cf7e027f9fb4f9

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9c54de33afcb37970fc6fcb1d8bc5f679ec569f75b731d33bb78d55e8a35d921
MD5 4d87925543ff5c64ef30d56ab1aa17e5
BLAKE2b-256 195ca5ef176ccd9f0ab7b55242fe85b8e1dee1d28ad32fdb4819916521f320a7

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 64b76ad2fc505c980a1e92c378c4d0b82f37a64c1c450ccc868e2822bb0e2e6e
MD5 792b237bb9ef6ccb611252daa4894bff
BLAKE2b-256 88386080a9d9de852cdb61f00c8ee579e0f54944aa91b2e30b8a06529238cfc0

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ba966ab8e75fe9faa6bf040fffce0f8542ea139be4590bff30720be24be36ddb
MD5 5eac43c2137912fc2a3898dd9efa0430
BLAKE2b-256 9fc699565c71213560b61d11e5ac4b4ee9ad8076e58192896aad534b6129a21c

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 419c60d9fdad011da6edabd0948f00bf3517d5fe7c6ef4ecf782d99b82a6b4b6
MD5 35fc20902ba5b774992ecec9d67381e3
BLAKE2b-256 f0861c68b071728287f86aa29b6b7ad6da9bc279c2d5f4d3122e55fbe6d09190

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 49b13b2868fbbe87e63f85fa5db5192c969658de5d5bf6904e0d6e40ae33ac73
MD5 f860972ad2b0835c4683bebc5a970d34
BLAKE2b-256 295b0ceeb7e4277173421b99373aeb0d4f90e989f996ca21c67e74b34aaaccc2

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c025012d7a377cffd512cace0e88c16e54d6877bee06f6b4a174313f31123b68
MD5 9019378974f0bdc4d9a123f553153a55
BLAKE2b-256 ab1c7325d2b03616c0d0843b6cc44830a544e02d12f119871ef9c970bfcdfc2e

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4baaaa2eec98b7ef232eb40dd1830991f2a7ea918f6d5fb55484e4ddb9093ee6
MD5 895a1fd5f9c408d4dab1d90f07d08e30
BLAKE2b-256 544d88652ca0f2034994aad2161dc92c856dbf122ee145f15c3f54f59b078107

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 679c1b649cb907d570dbb910aeb135f8c67d315a701ae455299a4d8cf5f41e66
MD5 33b6aead65863bb39aff5aaa8dd89781
BLAKE2b-256 d01e61b7a681d6b09bab83d0ba51057208a2d76397a5a46bede0e22491d2a1f2

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7bab9e92b57f31dc84ba78defc54784fa4c01d38498d20df4f7e39b9774fd904
MD5 d3fa468f2d95762c806d0ead937f4795
BLAKE2b-256 85d7eb2418ad0087d528c262b6553f4dfe567b7a514dfea8daec0a50c8779d76

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 5241db27cd111e53962946b0fc7e3441116ef63fd11f3762f87f62dc92972fce
MD5 4d5508963c5bc05eebc27ebd0c8bb3fc
BLAKE2b-256 49a004a90ac5474cf33ef782fdc5147b4cbf2a3f301b7ea385d75450a1587c2c

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp37-none-win_amd64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 cc9d25e2a791f40f7dd142d9911c8b0e998172a4ce997092885097c8803418c2
MD5 dd9f2143c851f65f2f74df87a5bab5cd
BLAKE2b-256 3d9e4857ddfdfc95b0e0e35454df202fc99158c0c9a87746ed43789217bb7cf0

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 353f9238a99da65e26cb7574d975c876b139efb78c5f2f3e3f360e2fd794b5c7
MD5 72a7318b7dcd3c95545a4963a893d5cf
BLAKE2b-256 a5814d9525fa52a92247e9b266a1a0a5374a5f05d652db0af54e750b3bafad3e

See more details on using hashes here.

Provenance

File details

Details for the file arrowdantic-0.1.0-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for arrowdantic-0.1.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 830561f80a250a45258ed4c5a1fc62a53791e013c8670a564f44e0185e7aac92
MD5 9ae01d2aca26ea402dda15cc44740a8c
BLAKE2b-256 3b89c5bb6b12370c59fe8d3ef826332a310bfc79ca8087c29af5a257e3715660

See more details on using hashes here.

Provenance

Supported by

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