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

Postgres Connection prints "encoding name too long" #347

Open
JonnyWaffles opened this issue Mar 1, 2022 · 0 comments
Open

Postgres Connection prints "encoding name too long" #347

JonnyWaffles opened this issue Mar 1, 2022 · 0 comments

Comments

@JonnyWaffles
Copy link

JonnyWaffles commented Mar 1, 2022

Description

When connecting to a Postgres 13 or 14 server in Python repl the following message "encoding name too long" is printed

>>> import turbodbc
>>> kwargs = {'server': 'postgres', 'port': 5432, 'database': 'airflow', 'uid': 'airflow', 'password': 'airflow'}
>>> c = turbodbc.connect(dsn="airflow", **kwargs)
encoding name too long
>>> 

My demo odbc.ini is as follows

[airflow]
Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so
Description=PostgreSQL DSN
ServerName=postgres
Port=5432
Database=airflow

I installed all the necessary packages in a bionic image

RUN apt-get install -y \
    python3.8-dev \
    unixodbc \
    unixodbc-dev \
    libboost-all-dev \
    odbc-postgresq

I tried both postgres server 13 and 14 images but the result was the same. In order to isolate whether the issue is specific to turbodbc I tried creating an isql session.

root@6430975942a8:/app# isql -v airflow airflow airflow
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+

And I don't see anything regarding encoding in the standard out. I also tried changing some of the default options, but the warning still is printed.

>>> opts = make_options(prefer_unicode=True)
>>> c = turbodbc.connect(dsn="airflow", turbodbc_options=opts, **kwargs)
encoding name too long
I tried the settings recommended in your readme and still see the same.
[airflow]
Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so
Description=PostgreSQL DSN
ServerName=postgres
Port=5432
Database=airflow
Protocol= 7.4
UseDeclareFetch=1
Fetch=10000
UseServerSidePrepare=1
BoolsAsChar=0
ConnSettings=set time zone 'UTC';

Any ideas why I am seeing this warning inside Python? I am hesitant to use the package because I don't know any side effects from the warning. Thanks for all your help!

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

1 participant