Choenden Kyirong
04/09/2023, 6:01 PMprefect_sqlalchemy.SqlAlchemyConnector
with execute_many(insert_query, seq_of_parameters)
where seq_of_parameters
has all the rows. This seems to take an extremely long time- a bit of a newbie here and i’m wondering if there are any approaches or advice for doing something like this?
Thanks!redsquare
04/09/2023, 8:04 PMChoenden Kyirong
04/09/2023, 8:33 PMprefect_sqlalchemy.SqlAlchemyConnector
, do we have access to those functions?
db_block=SqlAlchemyConnector.load("<name>")
conn = db_block.get_client(client_type="connection")
cursor = conn.cursor()
I’m trying to do this in order to access those functions from conn.cursor()
However, i’m getting the following error:
AttributeError: '_trans_ctx' object has no attribute 'cursor'
redsquare
04/09/2023, 8:38 PMChoenden Kyirong
04/09/2023, 8:44 PMredsquare
04/09/2023, 8:46 PMChoenden Kyirong
04/09/2023, 8:47 PMcopy_from()
works!
database_block = SqlAlchemyConnector.load("<name>")
with database_block.get_client(client_type="connection") as conn:
engine = database_block.get_client(client_type="engine")
connection = engine.raw_connection()
cursor = connection.cursor()
logger = get_run_logger()
cursor.copy_from(<filename>)
there may be a slicker way to do it- will look into that. but for now, testing this works.