-
Notifications
You must be signed in to change notification settings - Fork 57
feat: Add python FFI interface and expose sqlite and duckdb table providers #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
phillipleblanc
merged 21 commits into
datafusion-contrib:main
from
crystalxyz:pr-branch
Mar 24, 2025
Merged
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2d45e47
Setting up a workspace so we can add a second crate for python bindings
timsaucer-may 859315b
Initial commit of sqlite table provider in python example
timsaucer-may ff722e2
Cargo fmt
timsaucer 7caf641
Remove unwanted changes
crystalxyz bb10251
Fix cargo dependency issue and upgrade arrow version
crystalxyz f658c7a
Fix more cargo error
crystalxyz bae00c8
Fix python dependencies
crystalxyz ad3d352
Add Python Duckdb table provider implementation
crystalxyz 4485548
Remove comments and revise error msg
crystalxyz fef810f
Move arrow, datafusion and duckdb versions to main workspace cargo.toml
crystalxyz 2a86285
Fix linting error
crystalxyz b6bc6a2
Fix duckdb unit test
crystalxyz ae658ad
Merge branch 'main' into pr-branch
crystalxyz 8d6ff01
Fix styling
crystalxyz d4103bf
Refactor duckdb conn tokio runtime code to pass clippy test
crystalxyz b2fc837
Fix naming and add comment
crystalxyz 44a8c9f
Update cicd test command
crystalxyz 2723997
Change duckdb access mode interface to Enum type
crystalxyz eb5936d
Update documentation and fix python linting error
crystalxyz 43eeeaf
Revert a false change
crystalxyz 1834c78
Improve doc
crystalxyz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,165 +1,38 @@ | ||
| [package] | ||
| name = "datafusion-table-providers" | ||
| version = "0.3.0" | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| [workspace] | ||
| members = [ | ||
| "core", | ||
| "python", | ||
| ] | ||
| resolver = "2" | ||
|
|
||
| [workspace.package] | ||
| version = "0.2.3" | ||
| readme = "README.md" | ||
| edition = "2021" | ||
| repository = "https://github.com/datafusion-contrib/datafusion-table-providers" | ||
| license = "Apache-2.0" | ||
| description = "Extend the capabilities of DataFusion to support additional data sources via implementations of the `TableProvider` trait." | ||
|
|
||
| [dependencies] | ||
| [workspace.dependencies] | ||
| arrow = "54.2.1" | ||
| arrow-array = { version = "54.2.1", optional = true } | ||
| arrow-flight = { version = "54.2.1", optional = true, features = [ | ||
| "flight-sql-experimental", | ||
| "tls", | ||
| ] } | ||
| arrow-schema = { version = "54.2.1", optional = true, features = ["serde"] } | ||
| arrow-json = "54.2.1" | ||
| arrow-odbc = { version = "=15.1.1", optional = true } | ||
| async-stream = { version = "0.3", optional = true } | ||
| async-trait = "0.1" | ||
| base64 = { version = "0.22.1", optional = true } | ||
| bb8 = { version = "0.9", optional = true } | ||
| bb8-postgres = { version = "0.9", optional = true } | ||
| bigdecimal = "0.4" | ||
| byteorder = "1.5.0" | ||
| bytes = { version = "1.7.1", optional = true } | ||
| byte-unit = { version = "5.1.4", optional = true } | ||
| chrono = "0.4" | ||
| dashmap = "6.1.0" | ||
| datafusion = { version = "45", default-features = false } | ||
| datafusion-expr = { version = "45", optional = true } | ||
| datafusion-federation = { version = "=0.3.6", features = [ | ||
| "sql", | ||
| ], optional = true } | ||
| datafusion-physical-expr = { version = "45", optional = true } | ||
| datafusion-physical-plan = { version = "45", optional = true } | ||
| datafusion-proto = { version = "45", optional = true } | ||
| duckdb = { version = "=1.2.1", features = [ | ||
| "bundled", | ||
| "r2d2", | ||
| "vtab", | ||
| "vtab-arrow", | ||
| "appender-arrow", | ||
| ], optional = true } | ||
| libduckdb-sys = { version = "=1.2.1", optional = true } | ||
| dyn-clone = { version = "1.0", optional = true } | ||
| fallible-iterator = "0.3.0" | ||
| fundu = "2.0.1" | ||
| futures = "0.3" | ||
| geo-types = "0.7" | ||
| itertools = "0.14.0" | ||
| mysql_async = { version = "0.35", features = [ | ||
| "native-tls-tls", | ||
| "chrono", | ||
| "time", | ||
| "bigdecimal", | ||
| ], optional = true } | ||
| native-tls = { version = "0.2", optional = true } | ||
| num-bigint = "0.4" | ||
| odbc-api = { version = "11.1", optional = true } | ||
| pem = { version = "3.0.4", optional = true } | ||
| postgres-native-tls = { version = "0.5.0", optional = true } | ||
| prost = { version = "0.13", optional = true } | ||
| rand = { version = "0.9" } | ||
| r2d2 = { version = "0.8", optional = true } | ||
| rusqlite = { version = "0.32", optional = true } | ||
| sea-query = { version = "0.32", features = [ | ||
| "backend-sqlite", | ||
| "backend-postgres", | ||
| "postgres-array", | ||
| "with-rust_decimal", | ||
| "with-bigdecimal", | ||
| "with-time", | ||
| "with-chrono", | ||
| ] } | ||
| secrecy = "0.10.3" | ||
| serde = { version = "1.0", features = ["derive"] } | ||
| serde_json = "1.0" | ||
| sha2 = "0.10" | ||
| snafu = "0.8" | ||
| time = "0.3" | ||
| tokio = { version = "1.43", features = ["macros", "fs"] } | ||
| tokio-postgres = { version = "0.7", features = [ | ||
| "with-chrono-0_4", | ||
| "with-uuid-1", | ||
| "with-serde_json-1", | ||
| "with-geo-types-0_7", | ||
| ], optional = true } | ||
| tokio-rusqlite = { version = "0.6.0", optional = true } | ||
| tonic = { version = "0.12", optional = true, features = [ | ||
| "tls-native-roots", | ||
| "tls-webpki-roots", | ||
| ] } | ||
| tracing = "0.1" | ||
| trust-dns-resolver = "0.23.2" | ||
| url = "2.5.4" | ||
| uuid = { version = "1.11", optional = true } | ||
|
|
||
| [dev-dependencies] | ||
| anyhow = "1.0" | ||
| bollard = "0.18.1" | ||
| geozero = { version = "0.14.0", features = ["with-wkb"] } | ||
| insta = { version = "1.42.0", features = ["filters"] } | ||
| prost = { version = "0.13" } | ||
| rand = "0.9" | ||
| reqwest = "0.12" | ||
| rstest = "0.24.0" | ||
| test-log = { version = "0.2", features = ["trace"] } | ||
| tokio-stream = { version = "0.1", features = ["net"] } | ||
| tracing-subscriber = { version = "0.3", features = ["env-filter"] } | ||
|
|
||
| [features] | ||
| duckdb = [ | ||
| "dep:duckdb", | ||
| "dep:r2d2", | ||
| "dep:uuid", | ||
| "dep:dyn-clone", | ||
| "dep:async-stream", | ||
| "dep:arrow-schema", | ||
| "dep:byte-unit", | ||
| ] | ||
| duckdb-federation = ["duckdb", "federation"] | ||
| federation = ["dep:datafusion-federation"] | ||
| flight = [ | ||
| "dep:arrow-flight", | ||
| "datafusion/serde", | ||
| "dep:datafusion-proto", | ||
| "dep:prost", | ||
| "dep:tonic", | ||
| ] | ||
| mysql = ["dep:mysql_async", "dep:async-stream"] | ||
| mysql-federation = ["mysql", "federation"] | ||
| odbc = ["dep:odbc-api", "dep:arrow-odbc", "dep:async-stream", "dep:dyn-clone"] | ||
| odbc-federation = ["odbc", "federation"] | ||
| postgres = [ | ||
| "dep:tokio-postgres", | ||
| "dep:uuid", | ||
| "dep:postgres-native-tls", | ||
| "dep:bb8", | ||
| "dep:bb8-postgres", | ||
| "dep:native-tls", | ||
| "dep:pem", | ||
| "dep:async-stream", | ||
| "dep:arrow-schema", | ||
| ] | ||
| postgres-federation = ["postgres", "federation"] | ||
| sqlite = ["dep:rusqlite", "dep:tokio-rusqlite", "dep:arrow-schema"] | ||
| sqlite-federation = ["sqlite", "federation"] | ||
| sqlite-bundled = ["sqlite", "rusqlite/bundled"] | ||
|
|
||
| [[example]] | ||
| name = "odbc_sqlite" | ||
| path = "examples/odbc_sqlite.rs" | ||
| required-features = ["sqlite", "odbc"] | ||
|
|
||
| [[example]] | ||
| name = "flight-sql" | ||
| path = "examples/flight-sql.rs" | ||
| required-features = ["flight"] | ||
|
|
||
| [[example]] | ||
| name = "sqlite" | ||
| path = "examples/sqlite.rs" | ||
| required-features = ["sqlite"] | ||
| datafusion-ffi = { version = "45" } | ||
| datafusion-proto = { version = "45" } | ||
| datafusion-table-providers = { path = "core" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| [package] | ||
| name = "datafusion-table-providers" | ||
| version = "0.3.0" | ||
| readme = "README.md" | ||
| edition = "2021" | ||
| repository = "https://github.com/datafusion-contrib/datafusion-table-providers" | ||
| license = "Apache-2.0" | ||
| description = "Extend the capabilities of DataFusion to support additional data sources via implementations of the `TableProvider` trait." | ||
|
|
||
| [dependencies] | ||
| arrow = { workspace = true } | ||
| arrow-array = { version = "54.2.1", optional = true } | ||
| arrow-flight = { version = "54.2.1", optional = true, features = [ | ||
| "flight-sql-experimental", | ||
| "tls", | ||
| ] } | ||
| arrow-schema = { version = "54.2.1", optional = true, features = ["serde"] } | ||
| arrow-json = "54.2.1" | ||
| arrow-odbc = { version = "=15.1.1", optional = true } | ||
phillipleblanc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| async-stream = { version = "0.3", optional = true } | ||
| async-trait = "0.1" | ||
| base64 = { version = "0.22.1", optional = true } | ||
| bb8 = { version = "0.9", optional = true } | ||
| bb8-postgres = { version = "0.9", optional = true } | ||
| bigdecimal = "0.4" | ||
| byteorder = "1.5.0" | ||
| bytes = { version = "1.7.1", optional = true } | ||
| byte-unit = { version = "5.1.4", optional = true } | ||
| chrono = "0.4" | ||
| dashmap = "6.1.0" | ||
| datafusion = { version = "45", default-features = false } | ||
| datafusion-expr = { version = "45", optional = true } | ||
phillipleblanc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| datafusion-federation = { version = "=0.3.6", features = [ | ||
| "sql", | ||
| ], optional = true } | ||
| datafusion-physical-expr = { version = "45", optional = true } | ||
| datafusion-physical-plan = { version = "45", optional = true } | ||
| datafusion-proto = { version = "45", optional = true } | ||
| duckdb = { version = "=1.2.1", features = [ | ||
| "bundled", | ||
| "r2d2", | ||
| "vtab", | ||
| "vtab-arrow", | ||
| "appender-arrow", | ||
| ], optional = true } | ||
| libduckdb-sys = { version = "=1.2.1", optional = true } | ||
| dyn-clone = { version = "1.0", optional = true } | ||
| fallible-iterator = "0.3.0" | ||
| fundu = "2.0.1" | ||
| futures = "0.3" | ||
| geo-types = "0.7" | ||
| itertools = "0.14.0" | ||
| mysql_async = { version = "0.35", features = [ | ||
| "native-tls-tls", | ||
| "chrono", | ||
| "time", | ||
| "bigdecimal", | ||
| ], optional = true } | ||
| native-tls = { version = "0.2", optional = true } | ||
| num-bigint = "0.4" | ||
| odbc-api = { version = "11.1", optional = true } | ||
| pem = { version = "3.0.4", optional = true } | ||
| postgres-native-tls = { version = "0.5.0", optional = true } | ||
| prost = { version = "0.13", optional = true } | ||
| rand = { version = "0.9" } | ||
| r2d2 = { version = "0.8", optional = true } | ||
| rusqlite = { version = "0.32", optional = true } | ||
| sea-query = { version = "0.32", features = [ | ||
| "backend-sqlite", | ||
| "backend-postgres", | ||
| "postgres-array", | ||
| "with-rust_decimal", | ||
| "with-bigdecimal", | ||
| "with-time", | ||
| "with-chrono", | ||
| ] } | ||
| secrecy = "0.10.3" | ||
| serde = { version = "1.0", features = ["derive"] } | ||
| serde_json = "1.0" | ||
| sha2 = "0.10" | ||
| snafu = "0.8" | ||
| time = "0.3" | ||
| tokio = { version = "1.43", features = ["macros", "fs"] } | ||
| tokio-postgres = { version = "0.7", features = [ | ||
| "with-chrono-0_4", | ||
| "with-uuid-1", | ||
| "with-serde_json-1", | ||
| "with-geo-types-0_7", | ||
| ], optional = true } | ||
| tokio-rusqlite = { version = "0.6.0", optional = true } | ||
| tonic = { version = "0.12", optional = true, features = [ | ||
| "tls-native-roots", | ||
| "tls-webpki-roots", | ||
| ] } | ||
| tracing = "0.1" | ||
| trust-dns-resolver = "0.23.2" | ||
| url = "2.5.4" | ||
| uuid = { version = "1.11", optional = true } | ||
|
|
||
| [dev-dependencies] | ||
| anyhow = "1.0" | ||
| bollard = "0.18.1" | ||
| geozero = { version = "0.14.0", features = ["with-wkb"] } | ||
| insta = { version = "1.42.0", features = ["filters"] } | ||
| prost = { version = "0.13" } | ||
| rand = "0.9" | ||
| reqwest = "0.12" | ||
| rstest = "0.24.0" | ||
| test-log = { version = "0.2", features = ["trace"] } | ||
| tokio-stream = { version = "0.1", features = ["net"] } | ||
| tracing-subscriber = { version = "0.3", features = ["env-filter"] } | ||
|
|
||
| [features] | ||
| duckdb = [ | ||
| "dep:duckdb", | ||
| "dep:r2d2", | ||
| "dep:uuid", | ||
| "dep:dyn-clone", | ||
| "dep:async-stream", | ||
| "dep:arrow-schema", | ||
| "dep:byte-unit", | ||
| ] | ||
| duckdb-federation = ["duckdb", "federation"] | ||
| federation = ["dep:datafusion-federation"] | ||
| flight = [ | ||
| "dep:arrow-flight", | ||
| "datafusion/serde", | ||
| "dep:datafusion-proto", | ||
| "dep:prost", | ||
| "dep:tonic", | ||
| ] | ||
| mysql = ["dep:mysql_async", "dep:async-stream"] | ||
| mysql-federation = ["mysql", "federation"] | ||
| odbc = ["dep:odbc-api", "dep:arrow-odbc", "dep:async-stream", "dep:dyn-clone"] | ||
| odbc-federation = ["odbc", "federation"] | ||
| postgres = [ | ||
| "dep:tokio-postgres", | ||
| "dep:uuid", | ||
| "dep:postgres-native-tls", | ||
| "dep:bb8", | ||
| "dep:bb8-postgres", | ||
| "dep:native-tls", | ||
| "dep:pem", | ||
| "dep:async-stream", | ||
| "dep:arrow-schema", | ||
| ] | ||
| postgres-federation = ["postgres", "federation"] | ||
| sqlite = ["dep:rusqlite", "dep:tokio-rusqlite", "dep:arrow-schema"] | ||
| sqlite-federation = ["sqlite", "federation"] | ||
| sqlite-bundled = ["sqlite", "rusqlite/bundled"] | ||
|
|
||
| [[example]] | ||
| name = "odbc_sqlite" | ||
| path = "examples/odbc_sqlite.rs" | ||
| required-features = ["sqlite", "odbc"] | ||
|
|
||
| [[example]] | ||
| name = "flight-sql" | ||
| path = "examples/flight-sql.rs" | ||
| required-features = ["flight"] | ||
|
|
||
| [[example]] | ||
| name = "sqlite" | ||
| path = "examples/sqlite.rs" | ||
| required-features = ["sqlite"] | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.