Skip to content

Commit

Permalink
doc: Add example how to include latest datafusion (#9076)
Browse files Browse the repository at this point in the history
* doc: Add example how to include latest datafusion

* rm unused block

* Update docs/source/user-guide/example-usage.md

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
  • Loading branch information
comphead and alamb authored Jan 31, 2024
1 parent 102fbb4 commit c843226
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions docs/source/user-guide/example-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c843226

Please sign in to comment.