Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ dft serve-flightsql

# Start HTTP Server (requires `http` feature)
dft serve-http

# Generate TPC-H data in the configured DB path
dft generate-tpch
```

### Setting Up Tables with DDL
Expand Down Expand Up @@ -126,6 +129,7 @@ LOCATION 's3://bucket/delta_table';
| Feature | Documentation |
|---------|---------------|
| **Core Features** | [Features Guide](docs/features.md) |
| **Database** | [Database Guide](docs/db.md) |
| **TUI Interface** | [TUI Guide](docs/tui.md) |
| **CLI Usage** | [CLI Guide](docs/cli.md) |
| **FlightSQL Server** | [FlightSQL Guide](docs/flightsql_server.md) |
Expand Down
2 changes: 1 addition & 1 deletion crates/datafusion-app/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use super::wasm::create_wasm_udfs;
#[cfg(feature = "observability")]
use crate::observability::ObservabilityContext;

/// Structure for executing queries locally
/// Structure for executing queries
///
/// This context includes both:
///
Expand Down
8 changes: 8 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ This feature is still in it's early stages and is expected to evolve. Once it h
```sh
dft -c "SELECT ..." --analyze
```

## Generate TPC-H Data

Generate TPC-H data into your configured DB path

```sh
dft generate-tpch
```
23 changes: 23 additions & 0 deletions docs/db.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Database Guide

`dft` uses a configured database path to load tables into the DataFusion `SessionContext` for querying.

```
[db]
path = /path/to/db
```

Within this path it will look for a `tables` directory and then the expected path structure is `{catalog_name}/{schema_name}/{table_name}` where table name must be a directory where the tables data files are stored.

For example, after generating TPC-H data into the `dft` catalog and `tpch` schema the following paths are in the database path:

```
/path/to/db/tables/dft/tpch/customers/
/path/to/db/tables/dft/tpch/line_items/
/path/to/db/tables/dft/tpch/nations/
/path/to/db/tables/dft/tpch/orders/
/path/to/db/tables/dft/tpch/part_supps/
/path/to/db/tables/dft/tpch/parts/
/path/to/db/tables/dft/tpch/regions/
/path/to/db/tables/dft/tpch/suppliers/
```
2 changes: 1 addition & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub struct DftArgs {

impl DftArgs {
pub fn config_path(&self) -> PathBuf {
#[cfg(any(feature = "flightsql", feature = "http"))]
#[cfg(feature = "flightsql")]
if let Some(Command::ServeFlightSql {
config: Some(cfg), ..
}) = &self.command
Expand Down
2 changes: 2 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! [`CliApp`]: Command Line User Interface

use crate::config::AppConfig;
use crate::db::register_db;
use crate::{args::DftArgs, execution::AppExecution};
use color_eyre::eyre::eyre;
use color_eyre::Result;
Expand Down Expand Up @@ -617,6 +618,7 @@ pub async fn try_run(cli: DftArgs, config: AppConfig) -> Result<()> {
app_execution.with_flightsql_ctx(flightsql_ctx);
}
}
register_db(app_execution.session_ctx(), &config.db).await?;
let app = CliApp::new(app_execution, cli.clone());
app.execute_files_or_commands().await?;
Ok(())
Expand Down
Loading