Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add duration type when rust support it #26

Open
dovahcrow opened this issue Mar 2, 2021 · 5 comments
Open

Add duration type when rust support it #26

dovahcrow opened this issue Mar 2, 2021 · 5 comments
Assignees
Milestone

Comments

@dovahcrow
Copy link
Member

dovahcrow commented Mar 2, 2021

i16, f32/i32, interval, numeric, enum, bytes, char, time, timetz, uuid,

and add test

@dovahcrow dovahcrow changed the title add i32/f32 and possibly other types to pandastypes Add more data types for Postgres Mar 16, 2021
@dovahcrow dovahcrow added this to the 0.1 milestone Mar 16, 2021
@baggiponte
Copy link

Hi! I noticed last day that the interval type was not (yet) supported. It might be converted to arrow's Duration, am I right?

from __future__ import annotations

import os

import connectorx as cx
from dotenv import load_dotenv

load_dotenv()

user: str | None = os.getenv("POSTGRESQL_USER")
password: str | None = os.getenv("POSTGRESQL_PASSWORD")
host: str | None = os.getenv("POSTGRESQL_HOST")
port: str | None = os.getenv("POSTGRESQL_PORT")
database: str | None = os.getenv("POSTGRESQL_DATABASE")

connection_uri = f"postgres://{user}:{password}@{host}:{port}/{database}"

# get top 10 values from `durata_noleggio` col which is an `interval` type
cx.read_sql(connection_uri, "SELECT durata_noleggio FROM bikemi_data LIMIT 10")

thread '' panicked at 'not implemented: interval', /Users/runner/work/connector-x/connector-x/connectorx/src/sources/postgres/typesystem.rs:100:22
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Traceback (most recent call last):
File "/Users/luca/Documents/dev/python-projects/bikemi/.venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3398, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 18, in <cell line: 18>
cx.read_sql(connection_uri, "SELECT durata_noleggio FROM bikemi_data LIMIT 10")
File "/Users/luca/Documents/dev/python-projects/bikemi/.venv/lib/python3.9/site-packages/connectorx/init.py", line 224, in read_sql
result = _read_sql(
pyo3_runtime.PanicException: not implemented: interval

@wangxiaoying
Copy link
Contributor

Hi @baggiponte , yes we do not support interval for postgres. The supported types can be found here: https://sfu-db.github.io/connector-x/databases/postgres.html

The reason is that the underlying client driver we use doesn't support interval since there is no corresponding rust type developed: sfackler/rust-postgres#60. We will keep this on track.

@baggiponte
Copy link

Oh this is interesting - how does rust handle time durations? At this point, I guess it simply doesn't (Btw I thought the issue was solved because I saw the PR merged. Thank you for the nice reply!)

@wangxiaoying
Copy link
Contributor

how does rust handle time durations? At this point, I guess it simply doesn't

Yes, I think it doesn't support durations now.

Btw I thought the issue was solved because I saw the PR merged.

Which PR do you mean? I think the issue is still open: sfackler/rust-postgres#60?

@wangxiaoying wangxiaoying changed the title Add more data types for Postgres Add duration type when rust support it Sep 2, 2022
@wangxiaoying wangxiaoying reopened this Sep 2, 2022
@baggiponte
Copy link

I thought #71 (because after that the issue was marked as closed) but in fact in #71 you mention yourself intervals are not supported - sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants