1use datafusion::prelude::SessionContext;
2use datafusion_remote_table::{ConnectionOptions, PostgresConnectionOptions, RemoteTable};
3use std::sync::Arc;
4
5#[tokio::main]
6pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let options = ConnectionOptions::Postgres(PostgresConnectionOptions::new(
8 "localhost",
9 5432,
10 "user",
11 "password",
12 ));
13 let remote_table = RemoteTable::try_new(options, "select * from supported_data_types").await?;
14
15 let ctx = SessionContext::new();
16 ctx.register_table("remote_table", Arc::new(remote_table))?;
17
18 ctx.sql("select * from remote_table").await?.show().await?;
19
20 Ok(())
21}