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

Unable to connect to localhost using pandasai postgressql connector #1252

Open
jitendriyag2 opened this issue Jun 26, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@jitendriyag2
Copy link

System Info

While i am trying to connect to any of the remote db it is working as expected where are if i am trying to connect to localhost it is throwing below error

OperationalError: (psycopg2.OperationalError) could not translate host name "#@localhost" to address:

🐛 Describe the bug

While i am trying to connect to any of the remote db it is working as expected where are if i am trying to connect to localhost it is throwing below error

OperationalError: (psycopg2.OperationalError) could not translate host name "#@localhost" to address:

@dosubot dosubot bot added the bug Something isn't working label Jun 26, 2024
Copy link

dosubot bot commented Jun 26, 2024

Hello @jitendriyag2! I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together! 🤖

Ensure that the host parameter in your PostgreSQLConnector configuration is correctly set to "localhost" without any extraneous characters. Here is an example configuration:

from pandasai.connectors import PostgreSQLConnector

postgres_connector = PostgreSQLConnector(
    config={
        "host": "localhost",
        "port": 5432,
        "database": "mydb",
        "username": "root",
        "password": "root",
        "table": "payments",
    }
)

Double-check for any hidden characters or typos in the host field. If the issue persists, verify your PostgreSQL server configuration and network settings to ensure that "localhost" is correctly resolved. Additionally, make sure the dialect is set to "postgresql" and the driver is set to "psycopg2" in your configuration [1][2].

To continue talking to Dosu, mention @dosu.

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

1 participant