psqlpy-python / psqlpy

Asynchronous Python PostgreSQL driver written in Rust
https://psqlpy-python.github.io/
MIT License
227 stars 3 forks source link

SSL is required #40

Closed nikita-davydov closed 4 months ago

nikita-davydov commented 6 months ago

I'm trying to connect using ConnectonPool and getting an error psqlpy.exceptions.RustPSQLDriverPyBaseError: Database engine pool exception: Error occurred while creating a new object: db error: ERROR: odyssey: c1fc39c4c6d6c: SSL is required

My connection string works for all of the other existing drivers

Do you have any workaround?

chandr-andr commented 6 months ago

@nikita-davydov Hello! Thanks for the question.

Could you please provide your connection string? Do you specify any SSL configuration in other drivers?

nikita-davydov commented 6 months ago

The connection string is default postgres://log:pass@host:5432/db_name as usual

I'm using cloud managed database, if I use sslmode=verfiy-full, it says that it's invalid connection string: invalid value for option sslmode.

chandr-andr commented 6 months ago

@nikita-davydov Could you please try to specify sslmode=require? And send error message here if any

nikita-davydov commented 6 months ago

The result is Database engine pool exception: Error occurred while creating a new object: error performing TLS handshake: no TLS implementation configured

nikita-davydov commented 6 months ago

The documentation says that I should use sslmode=verify-full

reference

chandr-andr commented 6 months ago

Will it be ok if you try a new version of the driver from the branch? I'm gonna make some changes in the new branch and you'll try, ok?

I haven't had any production experience with cloud-managed databases, so we'll have to figure out the problem together)

nikita-davydov commented 6 months ago

Sure, looking forward your updates

chandr-andr commented 6 months ago

@nikita-davydov Could you, please, try to install the library from this branch https://github.com/qaspen-python/psqlpy/tree/feature/ssl_mode_problems and try again? I added the ability to set sslmode=verify-full and made other changes. I'm not sure it will help, we need to try tho.

chandr-andr commented 6 months ago

@nikita-davydov Btw. I haven't described anywhere how to work on this project and install it.

You need to: 1) Install rust (https://www.rust-lang.org/tools/install) 2) Install maturin (https://www.maturin.rs/installation) 3) Create new venv for maturin

> python3 -m venv .venv
> source .venv/bin/activate
> pip install -U pip maturin

Then you can run maturin develop and try to connect to your database within your new virtual env created on the third step (create any py file _test.py, as an example, and use PSQLPy like you installed it).

chandr-andr commented 5 months ago

@nikita-davydov Hello! Hope u a doing great! Did you have any time to test my solution?

chandr-andr commented 4 months ago

Closing this issue due to the latest release https://github.com/qaspen-python/psqlpy/releases/tag/0.7.1