Skip to content

Commit 366b791

Browse files
committed
chore: update README for library
1 parent 6c16892 commit 366b791

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,34 @@ picking up unfinished items.
1919

2020
- [x] datafusion-postgres as a CLI tool
2121
- [x] datafusion-postgres as a library
22-
- [x] datafusion information schema: a postgres compatible `information_schema`
22+
- [ ] datafusion information schema: a postgres compatible `information_schema`
2323
- [ ] datafusion pg catalog: a postgres compatible `pg_catalog`
2424
- [ ] data type mapping between arrow and postgres: in progress
2525
- [ ] additional postgres functions for datafusion
2626

2727
## Usage
2828

29+
### The Library `datafusion-postgres`
30+
31+
The high-level entrypoint of `datafusion-postgres` library is the `serve`
32+
function which takes a datafusion `SessionContext` and some server configuration
33+
options.
34+
35+
```rust
36+
use datafusion::prelude::SessionContext;
37+
use datafusion_postgres::{serve, ServerOptions};
38+
39+
// Create datafusion SessionContext
40+
let session_context = SessionContext::new();
41+
// Configure your `session_context`
42+
// ...
43+
44+
// Start the Postgres compatible server
45+
serve(session_context, &ServerOptions::new()).await
46+
```
47+
48+
### The CLI `datafusion-postgres-cli`
49+
2950
As a command-line application, this tool serves any JSON/CSV/Arrow/Parquet/Avro
3051
files as table, and expose them via Postgres compatible protocol, with which you
3152
can connect using psql or language drivers to execute `SELECT` queries against

0 commit comments

Comments
 (0)