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

PanicException: called Result::unwrap() Error { kind: ConfigParse, cause: Some("unexpected EOF") } #553

Closed
amarshall-deckers opened this issue Nov 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@amarshall-deckers
Copy link

amarshall-deckers commented Nov 14, 2023

What language are you using?

Python (3.7.7): sys.version_info(major=3, minor=7, micro=7, releaselevel='final', serial=0)

What version are you using?

connectorx 0.3.1

What database are you using?

Redshift

What dataframe are you using?

Arrow

Can you describe your bug?

I am getting an error when trying to run queries

What are the steps to reproduce the behavior?

Setup redshift test db/cluster. Using python 3.7.7 and connectorx as specified above, try running the python code shown

Database setup if the error only happens on specific data or data type

Table schema and example data

Example query / code
rs  = 'postgresql+psycopg2://<username><password"@<db_url>:<port>/<db>'
cx.read_sql(rs,"SELECT * FROM information_schema LIMIT 5")

What is the error?


PanicException Traceback (most recent call last)
in
----> 1 cx.read_sql(rs,"SELECT * FROM information_schema LIMIT 5")

~/.local/lib/python3.7/site-packages/connectorx/init.py in read_sql(conn, query, return_type, protocol, partition_on, partition_range, partition_num, index_col)
227 queries=queries,
228 protocol=protocol,
--> 229 partition_query=partition_query,
230 )
231 df = reconstruct_pandas(result)

PanicException: called Result::unwrap() on an Err value: Error { kind: ConfigParse, cause: Some("unexpected EOF") }

@amarshall-deckers amarshall-deckers added the bug Something isn't working label Nov 14, 2023
@amarshall-deckers
Copy link
Author

I needed to use redshift:// instead of psycopg2+postgresql://

@rwqzcq
Copy link

rwqzcq commented Jun 13, 2024

I needed to use redshift:// instead of psycopg2+postgresql://

work fine for me!

import connectorx as cx
from urllib.parse import quote_plus

pwd = quote_plus('mypassword')
SQLALCHEMY_GAUSSDB_PROD_CONNECT_STR = f'postgresql://myusername:{pwd}@xxx:xxx/xxx' # not working
SQLALCHEMY_GAUSSDB_PROD_CONNECT_STR = f'redshift://myusername:{pwd}@xxx:xxx/xxx' # working!
sql = "SELECT 1 FROM dual;"
start = time.time()
try:
    result = cx.read_sql(SQLALCHEMY_GAUSSDB_PROD_CONNECT_STR, sql)
    logger.warning(len(result))
except Exception as e:
    print(f"查询失败: {e}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants