CX_Oracle - import data from Oracle to Pandas dataframe CX_Oracle - import data from Oracle to Pandas dataframe python python

CX_Oracle - import data from Oracle to Pandas dataframe


You need to properly quote your SQL Query. If you look at the syntax highlighting in your question (or an IDE), you'll notice that the single quotes aren't working as you expect.

Change the outer most quotes to double quotes - if you want it all on one line - or triple quotes if you want it across multiple lines:

query = """SELECT*            FROM TRANSACTION           WHERE DIA_DAT >=to_date('15.02.28 00:00:00',  'YY.MM.DD HH24:MI:SS')           AND (locations <> 'PUERTO RICO'           OR locations <> 'JAPAN')           AND CITY='LONDON'"""df_ora = pd.read_sql(query, con=connection)