Skip to content
Advertisement

Tag: pyodbc

Python SQL: Error reading and executing SQL file

I’m trying to red and execute a SQL file in Python using sqlalchemy. Should be simple, right? I get this error Why am I getting this error? I’m not sure if this is a file encoding error or a SQLAlchemy error. Ideally, this should be simple. EDIT: This code works fine, assuming the table temp exists: EDIT 2: For reference,

Query table with compound primary keys

I’m using pyodbc to connect to a machine database, and query a number of tables in that database using pandas.read_sql(tbl,cnxn), where tbl = “SELECT * FROM TABLE”, cnxn is pyodbc.connect(‘DSN=DATASOURCE;UID=USERID;PWD=PASSWORD’). It works on most tables, but some tables return: DatabaseError: Execution failed on sql ‘SELECT * FROM TABLE’: (’42S02′, ‘[42S02] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00942: table or view does not exist

Python -SQL String Escape Wildcards

I tried to see if this question had been asked, which it probably has, but I couldn’t find an answer. I am querying MS SQL Server from a python script using pyodbc. I am defining a function to query …

Advertisement