Commit e860fadc authored by mouadh's avatar mouadh

optimization 2 (use iter instead fetchall())

parent 732b4d9d
...@@ -28,9 +28,10 @@ def _load_tables_db(executer_instance): ...@@ -28,9 +28,10 @@ def _load_tables_db(executer_instance):
.execution_options(stream_results=True) .execution_options(stream_results=True)
.execute('SELECT * FROM "{0}"'.format(table_name))) .execute('SELECT * FROM "{0}"'.format(table_name)))
# Fetch all the results of the query # Fetch all the results of the query
fetchall = results.fetchall() # fetchall = results.fetchall()
# fetchall = results.fetchone() # # fetchall = results.fetchone()
value = pd.DataFrame(fetchall,columns=results.keys()) # value = pd.DataFrame(fetchall,columns=results.keys())
value = pd.DataFrame(iter(results),columns=results.keys()) # Pass results as an iterator
tables[table_name] = value[[ tables[table_name] = value[[
col for col in value.columns if col.lower()[-3:] != '_id' col for col in value.columns if col.lower()[-3:] != '_id'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment