Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dtypes1 = {c:types.VARCHAR(df[c].str.len().max()) for c in df.columns[df.dtypes == 'object'].tolist()}
- df.to_sql('table1', conn2, if_exists='replace', dtype=dtypes1, index=false)
- conn = create_engine('oracle+cx_oracle://.......')
- SQL_statement = 'MERGE INTO ' + table2 + ' USING ' + table1 + ' ON (' + table1 + '.TIME = ' + table2 + '.TIME AND ' + table1 + '.ID = ' + table2 + '.ID) WHEN MATCHED THEN UPDATE SET ' + updateMsg + ' WHEN NOT MATCHED THEN INSERT (' + insertMsgB + ') VALUES (' + insertMsgA + ')'
- conn.execute(SQL_statement)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement