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