V
V
Vladislav2020-12-23 22:30:01
Python
Vladislav, 2020-12-23 22:30:01

What is the best way to read data from the database?

We write the transfer of data from one database to another. We use pyodbc.
There is a lot of data, tables are long. We decide with a colleague how best to read the data.
1. do a fetchall
2. cycle through the cursor
Which way to read is faster? more reliable? save on memory?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-12-24
@dimonchik2013

read obviously with the cursor
insert - beam

D
d-stream, 2020-12-23
@d-stream

I think that in the first place it is worth optimizing a heavier record. Here bulk insert is a panacea.
By the way, I don’t exclude at all the crasy option of subtraction into a text file in the form of sql insert blocks and their subsequent execution through bulk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question