You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run an example from this page to load simple table from postgres into a dataframe, but fails with error below. Any idea what is wrong?
Note:
happening in windows wsl / ubuntu.
db connection string is redacted
would have asked on stackoverflow, but there is no connectorx tag and i dont have enough reputation to create it
Finished dev [unoptimized + debuginfo] target(s) in 19.23s
Running `target/debug/insight`
thread 'main' panicked at 'run failed: PostgresError(PostgresPoolError(Error(Some("error connecting to server: Protocol not available (os error 92)"))))', src/main.rs:22:63
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
running following works fine.
psql -h 192.168.48.106 -U user db
Cargo.toml looks like this
[package]
name = "testapp"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
parquet = "40.0.0"
polars = { version = "0.30.0", features = ["lazy","temporal","describe","json","parquet","dtype-datetime","dtype-categorical", "sql", "streaming", "serde-lazy", "ipc", "dynamic_groupby", "sort_multiple", "rows", "dataframe_arithmetic", "partition_by"] }
serde = "1.0.163"
serde_json = "1.0.96"
connectorx = { version = "0.3.1", features = ["src_postgres", "dst_arrow", "dst_arrow2"] }
Overall code looks like this:
use parquet::file::reader::{FileReader, SerializedFileReader};
use std::{fs::File, path::Path};
use polars::prelude::*;
use connectorx::prelude::*;
use std::convert::TryFrom;
fn main() {
//let _ = _parquet();
//let _ = _dataframe();
//let _ = _dataframe2();
let _ = _load_from_sql();
}
fn _load_from_sql() -> Result<String, String> {
let mut source_conn = SourceConn::try_from("postgresql://user:[email protected]:5432/db").expect("parse conn str failed");
let queries = &[
CXQuery::from("SELECT * FROM demo_data WHERE id < 100"),
CXQuery::from("SELECT * FROM demo_data WHERE id >= 900")
];
let destination = get_arrow2(&source_conn, None, queries).expect("run failed");
let _data = destination.polars();
println!("{:?}", _data);
Ok("done".to_string())
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to run an example from this page to load simple table from postgres into a dataframe, but fails with error below. Any idea what is wrong?
Note:
connectorx
tag and i dont have enough reputation to create itrunning following works fine.
Cargo.toml
looks like thisOverall code looks like this:
Beta Was this translation helpful? Give feedback.
All reactions