# Flow Variables for DB Query

**URL:** <https://forum.knime.com/t/flow-variables-for-db-query/60301>\
**Category:** KNIME Analytics Platform\
**Created:** [January 24, 2023, 7:59pm UTC](https://forum.knime.com/t/flow-variables-for-db-query/60301 "2023-01-24T19:59:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [January 24, 2023, 10:06pm UTC](https://forum.knime.com/t/flow-variables-for-db-query/60301/2 "2023-01-24T22:06:11Z")

</div>

@terbe one idea indeed could be to do this in chunks and control that via flow variables. Though the task sounds large indeed. Could you identify what the bottleneck might be? Is it the network speed or the process on your machine? One idea could be to utilize parallelization if the database connection allows for multiple accesses at once.

> **[Download data from a database in chunks and append them to an CSV file –...](https://hub.knime.com/mlauber71/spaces/Public/kn_example_write_csv_loop_chunks/m_001_write_csv_loop_chunks~-njjNfdjCt05FaKE/current-state)**
>
> Download data from a database in chunks and append them to an CSV file The example uses ROWIDs from SQLite. You could see if you either have a ROWIDs present o…

> [@Export huge MS sql table to csv without fetching all records together](https://forum.knime.com/t/export-huge-ms-sql-table-to-csv-without-fetching-all-records-together/15105/2):
>
> have you thought about doing it in chunks? And then appending the result to a CSV file. The example attached uses ROWIDs from SQLite. You could see if you either have a ROWIDs present or you could create one yourself. You can choose the size of the chunk/batch yourself (I use integers you might have to see if with very large numbers you might need big integers or something. Even a workaround with using strings might be possible). Only other idea would be to write a CSV file directly on a Big Da…

You also should think about a mechanism to store which entries you already have processed so you could continue at a certain point in case your task fails.

> **[KNIME forum question: download a list of files, save them, import as CSV and...](https://hub.knime.com/mlauber71/spaces/Public/forum/kn_forum_links_download_geodesy2~Mdwadyn22TyvbjMM/current-state)**
>
> KNIME forum question: download a list of files, save them, import as CSV and collect all data

> [@"CSV Writer" node cannot write the word COM?](https://forum.knime.com/t/csv-writer-node-cannot-write-the-word-com/20623/2):
>
> Not exactly sure what happened but again I have this modified solution to offer that would first download the files and later import them all into CSV and even collect them in a KNIME table in the end. If one download fails you could resume the download, that might be faster and more robust than to use the file reader directly. In the hub, there are all files contained from your example. As a side note, you might want to think about using the [relative KNIME paths](https://forum.knime.com/t/extract-rows-data-in-multiple-text-files-and-name-files-basis-a-row-cell-value/12556/8) like: knime://knim…

---

_[View the full topic](https://forum.knime.com/t/flow-variables-for-db-query/60301)._
