diff --git a/Cargo.lock b/Cargo.lock index 6cd635a..a07015e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -1477,7 +1477,7 @@ dependencies = [ [[package]] name = "datafusion-postgres-cli" -version = "0.1.0" +version = "0.4.0" dependencies = [ "datafusion", "datafusion-postgres", diff --git a/Cargo.toml b/Cargo.toml index 574acdb..5d6505b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,18 @@ resolver = "2" members = ["datafusion-postgres", "datafusion-postgres-cli"] +[workspace.package] +version = "0.4.0" +edition = "2021" +license = "Apache-2.0" +rust-version = "1.82.0" +authors = ["Ning Sun "] +keywords = ["database", "postgresql", "datafusion"] +homepage = "https://github.com/sunng87/datafusion-postgres/" +repository = "https://github.com/sunng87/datafusion-postgres/" +documentation = "https://docs.rs/crate/datafusion-postgres/" +readme = "README.md" + [workspace.dependencies] pgwire = "0.30.2" datafusion = { version = "47", default-features = false } diff --git a/README.md b/README.md index 7a3a593..68a65e8 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,34 @@ picking up unfinished items. - [x] datafusion-postgres as a CLI tool - [x] datafusion-postgres as a library -- [x] datafusion information schema: a postgres compatible `information_schema` +- [ ] datafusion information schema: a postgres compatible `information_schema` - [ ] datafusion pg catalog: a postgres compatible `pg_catalog` - [ ] data type mapping between arrow and postgres: in progress - [ ] additional postgres functions for datafusion ## Usage +### The Library `datafusion-postgres` + +The high-level entrypoint of `datafusion-postgres` library is the `serve` +function which takes a datafusion `SessionContext` and some server configuration +options. + +```rust +use datafusion::prelude::SessionContext; +use datafusion_postgres::{serve, ServerOptions}; + +// Create datafusion SessionContext +let session_context = SessionContext::new(); +// Configure your `session_context` +// ... + +// Start the Postgres compatible server +serve(session_context, &ServerOptions::new()).await +``` + +### The CLI `datafusion-postgres-cli` + As a command-line application, this tool serves any JSON/CSV/Arrow/Parquet/Avro files as table, and expose them via Postgres compatible protocol, with which you can connect using psql or language drivers to execute `SELECT` queries against diff --git a/datafusion-postgres-cli/Cargo.toml b/datafusion-postgres-cli/Cargo.toml index d443d6d..21e8c93 100644 --- a/datafusion-postgres-cli/Cargo.toml +++ b/datafusion-postgres-cli/Cargo.toml @@ -1,14 +1,19 @@ [package] name = "datafusion-postgres-cli" -version = "0.1.0" -edition = "2021" -rust-version = "1.82.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +description = "Command-line tool for DataFusion's Postgres Protocol frontend" +version.workspace = true +edition.workspace = true +license.workspace = true +authors.workspace = true +keywords.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +readme.workspace = true [dependencies] pgwire = { workspace = true } datafusion = { workspace = true, default-features = true, features = ["avro"] } tokio = { workspace = true, features = ["full"] } -datafusion-postgres = { path = "../datafusion-postgres" } +datafusion-postgres = { path = "../datafusion-postgres", version = "0.4.0" } structopt = { version = "0.3", default-features = false } diff --git a/datafusion-postgres/Cargo.toml b/datafusion-postgres/Cargo.toml index b66bb72..1edb18a 100644 --- a/datafusion-postgres/Cargo.toml +++ b/datafusion-postgres/Cargo.toml @@ -1,19 +1,15 @@ [package] name = "datafusion-postgres" -version = "0.4.0" -edition = "2021" -rust-version = "1.82.0" description = "Exporting datafusion query engine with postgres wire protocol" -authors = ["Ning Sun "] -license = "Apache-2.0" -keywords = ["database", "postgresql"] -homepage = "https://github.com/sunng87/datafusion-postgres/" -repository = "https://github.com/sunng87/datafusion-postgres/" -documentation = "https://docs.rs/crate/datafusion-postgres/" -readme = "../README.md" - - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +version.workspace = true +edition.workspace = true +license.workspace = true +authors.workspace = true +keywords.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +readme.workspace = true [dependencies] async-trait = "0.1" diff --git a/flake.nix b/flake.nix index 6f8e9b4..44ac8bb 100644 --- a/flake.nix +++ b/flake.nix @@ -37,6 +37,7 @@ "rust-analyzer" ]) cargo-nextest + cargo-release curl gnuplot ## for cargo bench pythonEnv