When the file does not fit in RAM

CSV to SQL Server in C#

The file can be larger than memory. The load is still fast. One API for every database.

A partner drops a CSV. It might be bigger than the machine. You still need it in the table tonight — SQL Server, Postgres, MySQL, Oracle, or SQLite.

ETLBox streams the file and bulk-inserts as it reads. Nothing has to fit in memory. The same code hits every supported database.

var conn = new SqlConnectionManager(connString);
var source = new CsvSource("orders.csv");
var dest = new DbDestination(conn, "Orders");

source.LinkTo(dest);
Network.Execute(source);

Swap the connection manager. The source stays.

Stream and bulk-load. Do not load the file first.

A script that reads the whole CSV into a list is simple until the file grows. Then memory is the limit, and row-by-row inserts are slow. ETLBox never holds the file. It bulk-inserts into every database we support — not a one-off for a single engine.

ETLBox

File in, table loaded

  • Streams — the file does not have to fit in memory
  • Bulk insert on every supported database
  • Fast enough for nightly partner files
  • SQL Server, Postgres, MySQL, Oracle, and the rest
  • Excel, JSON, XML, Parquet — same pattern
A custom script

Load it, then insert

  • The whole file sits in RAM
  • Row-by-row inserts get slow
  • Each database wants its own bulk path
  • The next format is another script
  • Fine for a sample, not for production volume

Every database. The next file, too.

Bulk insert is not a SQL Server trick. Native bulk where the engine has it, ODBC and OLEDB when you need a generic path. When the partner sends Excel or JSON instead, the pattern stays.

Databases

SQL Server SQL Server
Azure SQL Azure SQL
PostgreSQL PostgreSQL
Oracle Oracle
MySQL MySQL
MariaDB MariaDB
SQLite SQLite
IBM Db2 IBM Db2
SAP ASE SAP ASE
SAP HANA SAP HANA
Snowflake Snowflake
ClickHouse ClickHouse
Microsoft Access Microsoft Access
Apache Spark Apache Spark
ODBC ODBC
OLE DB OLE DB

Files and formats

CSV CSV
Excel Excel
JSON JSON
XML XML
Parquet Parquet
Text Text

Database connectors · Streaming connectors

Used in production

Commonwealth Bank of Australia, Deloitte, Health Catalyst, SEW Eurodrive, Calpine, FASTEC. Nightly file loads that do not fit in memory are why the library exists.

Try the load

CSV in. Table loaded.

A trial key unlocks the full library. NuGet without a key is limited to 5,000 rows per data flow.

Get a free trial key See the recipe

Commonwealth Bank of Australia
Australia

Brunata
Denmark

Deloitte
Ireland, India

IWG
Switzerland

National Bank of Serbia
Serbia

Flowwright
USA

FASTEC
Germany

Calpine Energy Solutions
USA

Digitain
Armenia

Health Catalyst
USA

Regal Rexnord
USA, Mexiko

Normandin Beaudry
Canada

Djøf
Denmark

ATD Solutions Ltd.
U.K.