Skip to content

Apache DataFusion SQL Query Engine

doc: Add example how to include latest datafusion (#9076)

compheadc843226d84f7
diff --git a/docs/source/user-guide/example-usage.md b/docs/source/user-guide/example-usage.md
index 77b196c124..fd525608d3 100644
--- a/docs/source/user-guide/example-usage.md
+++ b/docs/source/user-guide/example-usage.md
@@ -23,7 +23,7 @@ In this example some simple processing is performed on the [`example.csv`](https
Even [`more code examples`](https://github.com/apache/arrow-datafusion/tree/main/datafusion-examples) attached to the project.
-## Update `Cargo.toml`
+## Add DataFusion as a dependency
Find latest available Datafusion version on [DataFusion's
crates.io] page. Add the dependency to your `Cargo.toml` file:
@@ -33,6 +33,29 @@ datafusion = "31"
tokio = "1.0"
```
+## Add DataFusion latest codebase as a dependency
+
+Cargo supports adding dependency directly from Github which allows testing out latest DataFusion codebase without waiting the code to be released to crates.io
+according to the [DataFusion release schedule](https://github.com/apache/arrow-datafusion/blob/main/dev/release/README.md#release-process)
+
+```toml
+datafusion = { git = "https://github.com/apache/arrow-datafusion", branch = "main"}
+```
+
+Also it works on the package level
+
+```toml
+datafusion-common = { git = "https://github.com/apache/arrow-datafusion", branch = "main", package = "datafusion-common"}
+```
+
+And with features
+
+```toml
+datafusion = { git = "https://github.com/apache/arrow-datafusion", branch = "main", default-features = false, features = ["unicode_expressions"] }
+```
+
+More on [Cargo dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies)
+
## Run a SQL query against data stored in a CSV:
```rust
@@ -239,7 +262,7 @@ like error backtrace. To enable a backtrace you need to add Datafusion `backtrac
datafusion = { version = "31.0.0", features = ["backtrace"]}
```
-Set environment [`variables`] https://doc.rust-lang.org/std/backtrace/index.html#environment-variables
+Set environment [variables](https://doc.rust-lang.org/std/backtrace/index.html#environment-variables)
```bash
RUST_BACKTRACE=1 ./target/debug/datafusion-cli