Sinaptik-AI / pandas-ai

Chat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.
https://pandas-ai.com
Other
11.7k stars 1.08k forks source link

Unable to connect to localhost using pandasai postgressql connector #1252

Open jitendriyag2 opened 5 days ago

jitendriyag2 commented 5 days ago

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[bot] commented 5 days ago

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.