Skip to content

Commit

Permalink
flight-sql-server: add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hozan23 committed Dec 22, 2024
1 parent a5b3b2e commit 97dca62
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
41 changes: 41 additions & 0 deletions datafusion-flight-sql-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# DataFusion Flight SQL Server

The `datafusion-flight-sql-server` is a Flight SQL server that implements the
necessary endpoints to use DataFusion as the query engine.

## Getting Started

To use `datafusion-flight-sql-server` in your Rust project, run:

```sh
$ cargo add datafusion-flight-sql-server
```

## Example

Here's a basic example of setting up a Flight SQL server:

```rust
use datafusion_flight_sql_server::service::FlightSqlService;
use datafusion::{
execution::{
context::SessionContext,
options::CsvReadOptions,
},
};

async {
let dsn: String = "0.0.0.0:50051".to_string();
let remote_ctx = SessionContext::new();
remote_ctx
.register_csv("test", "./examples/test.csv", CsvReadOptions::new())
.await.expect("Register csv");

FlightSqlService::new(remote_ctx.state()).serve(dsn.clone())
.await
.expect("Run flight sql service");

};
```

This example sets up a Flight SQL server listening on `127.0.0.1:50051`.
2 changes: 2 additions & 0 deletions datafusion-flight-sql-server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![doc = include_str!("../README.md")]

pub mod service;
pub mod session;
pub mod state;

0 comments on commit 97dca62

Please sign in to comment.