python - SQLAlchemy Query to create table in second database -


i using pandas query different databases (usually oracle) , store in single postgres database. cases querying results create table without making use of pandas power. large queries memory intensive since pandas retrieves rows before running inserts.

i interested know if can accomplish sqlalchemy expressions alone.

sample of pandas code (very simple)

import pandas pd sqlalchemy import create_engine  engineora = create_engine('oracle://user:passwd@oraclehost:port/sid') engine = create_engine('postgresql://user:passwd@localhost:5432/dbname')  data = pd.read_sql_query(sqlselect, engineora) data.to_sql('table_name',engine, if_exists='replace') 

this works great other large result sets. started investigate way in straight sqlalchemy expression (ideally low memory usage) without luck.

engineora = create_engine('oracle://user:passwd@oraclehost:port/sid') engine = create_engine('postgresql://user:passwd@localhost:5432/dbname') results = (engineora.connect().execution_options(stream_results=true).execute(sqlselect)) 

i tried various ways find information columns/types in results , use create table , inserts results - not luck. might possible working through sqlalchemy?


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -