bcpandas icon indicating copy to clipboard operation
bcpandas copied to clipboard

InterfaceError

Open vlasvlasvlas opened this issue 3 years ago • 5 comments

I get sqlalchemy.exc.InterfaceError / pyodbc.InterfaceError 28000

the same data config works fine when i used a direct sqlalchemy connection with pandas to_sql, i'm connecting to an specific enviroment (host/enviroment) what could this be? thanks

ps: output is: "sqlalchemy.exc.InterfaceError: (pyodbc.InterfaceError) ('28000', "[28000] [Microsoft] [ODBC 17 for SQL Server][SQL Server] Login failed for user 'USERNAME' (18456) (SQLDriverConnect); [28000] [Microsoft] [ODBC 17 for SQL Server][SQL Server] Login failed for user 'USERNAME'. (18456)"

  • user is modified here , but i do connect OK when using sqlmanagmentstudio, sqlalchemy, pandas, and pyodbc.

vlasvlasvlas avatar Feb 10 '21 06:02 vlasvlasvlas

ok, this reformat worked for me. main.py frome line 95:

        # 
        # construct the engine for sqlalchemy
        if odbc_kwargs:
            db_url += ";".join(f"{k}={v}" for k, v in odbc_kwargs.items())
        conn_string = f"mssql+pyodbc:///?odbc_connect={quote_plus(db_url)}"
        # fix STAGE
        conn_string = f"mssql+pyodbc://*USER*:*PASSWORD*@*HOST*\\*INSTANCE*/*DATABASE*?driver=ODBC+Driver+17+for+SQL+Server;MARS_Connection=Yes"
        self.engine = sa.engine.create_engine(conn_string)

would be great to have full engine config,

vlasvlasvlas avatar Feb 11 '21 16:02 vlasvlasvlas

I'm not clear - what did you change exactly? And can you post the connection string originally that wasn't working (obviously redact or substitute all sensitive parts)?

yehoshuadimarsky avatar Feb 11 '21 16:02 yehoshuadimarsky

Hi! sorry about the delay.

This is what i try and didnt work:

creds = SqlCreds(server="SERVERNAME", database="DB", username="USERNAME", password="PASSWORD") creds = SqlCreds(server="SERVER\INSTANCE", database="DB", port=MYPORT)

i always got "pyodbc.InterfaceError: ('28000', "[28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server"

something similar as here: https://stackoverflow.com/questions/54098945/pyodbc-interfaceerror

hard-coded solution: the thing is: when i hardcode the full connstring inside main.py it worked.

vlasvlasvlas avatar Feb 19 '21 12:02 vlasvlasvlas

I dunno if this is still an issue or if its ok to close this one, @yehoshuadimarsky have you test / recreate this issue?

vlasvlasvlas avatar Mar 02 '22 00:03 vlasvlasvlas

no idea, I do not have a test for this and have not tried recreating it recently

yehoshuadimarsky avatar Mar 02 '22 19:03 yehoshuadimarsky