NPipeline.Connectors.MySql
0.54.0
dotnet add package NPipeline.Connectors.MySql --version 0.54.0
NuGet\Install-Package NPipeline.Connectors.MySql -Version 0.54.0
<PackageReference Include="NPipeline.Connectors.MySql" Version="0.54.0" />
<PackageVersion Include="NPipeline.Connectors.MySql" Version="0.54.0" />
<PackageReference Include="NPipeline.Connectors.MySql" />
paket add NPipeline.Connectors.MySql --version 0.54.0
#r "nuget: NPipeline.Connectors.MySql, 0.54.0"
#:package NPipeline.Connectors.MySql@0.54.0
#addin nuget:?package=NPipeline.Connectors.MySql&version=0.54.0
#tool nuget:?package=NPipeline.Connectors.MySql&version=0.54.0
NPipeline.Connectors.MySQL
A fully-async MySQL and MariaDB connector for NPipeline, built on MySqlConnector (MIT).
Installation
dotnet add package NPipeline.Connectors.MySQL
Quick Start
using NPipeline.Connectors.MySql.Nodes;
// Source: read rows from MySQL
var source = new MySqlSourceNode<Product>(
connectionString: "Server=localhost;Database=shop;User=root;Password=root;",
query: "SELECT * FROM `products`");
// Sink: write rows to MySQL
var sink = new MySqlSinkNode<Product>(
connectionString: "Server=localhost;Database=shop;User=root;Password=root;",
tableName: "products");
Dependency Injection
using Microsoft.Extensions.DependencyInjection;
using NPipeline.Connectors.MySql.DependencyInjection;
services.AddMySqlConnector(options =>
{
options.DefaultConnectionString =
"Server=localhost;Database=shop;User=root;Password=root;";
options.AddOrUpdateConnection("analytics",
"Server=analytics-host;Database=analytics;User=etl;Password=secret;");
options.DefaultConfiguration = new MySqlConfiguration
{
MinPoolSize = 2,
MaxPoolSize = 20,
MaxRetryAttempts = 3,
RetryDelay = TimeSpan.FromSeconds(2),
};
});
Attribute Mapping
using NPipeline.Connectors.MySql.Mapping;
using NPipeline.Connectors.Attributes;
[MySqlTable("products")]
public class Product
{
[MySqlColumn("product_id", AutoIncrement = true)]
public int Id { get; set; }
[Column("name")]
public string Name { get; set; } = string.Empty;
[MySqlColumn("unit_price")]
public decimal Price { get; set; }
[IgnoreColumn]
public bool InStock { get; set; }
}
Write Strategies
| Strategy | Class | Notes |
|---|---|---|
| PerRow | MySqlPerRowWriter |
One INSERT per row; simplest, lowest throughput |
| Batch | MySqlBatchWriter |
Multi-row INSERT VALUES (…),(…) |
| BulkLoad | MySqlBulkLoadWriter |
LOAD DATA LOCAL INFILE - highest throughput |
Configure via MySqlConfiguration.WriteStrategy:
var config = new MySqlConfiguration
{
WriteStrategy = MySqlWriteStrategy.Batch,
BatchSize = 500,
};
var sink = new MySqlSinkNode<Product>(connectionString, "products", config);
Upsert
var config = new MySqlConfiguration
{
UseUpsert = true,
UpsertKeyColumns = ["product_id"],
OnDuplicateKeyAction = OnDuplicateKeyAction.Update, // or .Ignore / .Replace
};
var sink = new MySqlSinkNode<Product>(connectionString, "products", config);
Generated SQL example:
INSERT INTO `products` (`product_id`, `name`, `unit_price`)
VALUES (@p0, @p1, @p2)
ON DUPLICATE KEY UPDATE `name` = VALUES(`name`), `unit_price` = VALUES(`unit_price`);
StorageUri
// mysql:// or mariadb:// schemes are both supported
var uri = StorageUri.Parse("mysql://root:root@localhost:3306/shop");
var source = new MySqlSourceNode<Product>(uri, "SELECT * FROM `products`");
var sink = new MySqlSinkNode<Product>(uri, "products");
Configuration Reference
| Property | Default | Description |
|---|---|---|
ConnectionTimeout |
30 s | TCP connect timeout |
CommandTimeout |
30 s | SQL execution timeout |
MinPoolSize |
1 | Minimum open connections in pool |
MaxPoolSize |
10 | Maximum open connections in pool |
WriteStrategy |
PerRow |
PerRow, Batch, BulkLoad |
BatchSize |
100 | Rows per batch (Batch strategy) |
MaxRetryAttempts |
3 | Retry count on transient errors |
RetryDelay |
2 s | Initial retry back-off |
UseUpsert |
false |
Enable upsert semantics |
UpsertKeyColumns |
[] |
Columns forming the upsert key |
OnDuplicateKeyAction |
Update |
Update, Ignore, Replace |
AllowUserVariables |
true |
Allow @variable syntax |
ConvertZeroDateTime |
true |
Map MySQL 0000-00-00 to DateTime.MinValue |
AllowLoadLocalInfile |
false |
Enable LOAD DATA LOCAL INFILE (BulkLoad) |
Transient Error Handling
The connector automatically retries on the following MySQL error codes:
| Code | Description |
|---|---|
| 1040 | Too many connections |
| 1205 | Lock wait timeout exceeded |
| 1213 | Deadlock found |
| 2006 | MySQL server has gone away |
| 2013 | Lost connection to MySQL server |
Checkpointing
var config = new MySqlConfiguration
{
CheckpointStrategy = CheckpointStrategy.KeyBased,
CheckpointColumn = "updated_at",
};
Supported strategies: None, InMemory, Offset, KeyBased, Cursor, CDC.
Custom Row Mapper
var source = new MySqlSourceNode<Product>(
connectionString,
"SELECT product_id, name FROM `products`",
row => new Product
{
Id = row.Get<int>("product_id"),
Name = row.Get<string>("name") ?? string.Empty,
});
MariaDB Support
Both mysql:// and mariadb:// StorageUri schemes resolve to MySqlDatabaseStorageProvider. The MySqlConnector driver is fully compatible with MariaDB
10.5+.
License
This package is licensed under the Business Source License 1.1.
Free for non-production use. Production use is free for organizations with 4 or fewer developers and annual revenue of $5M AUD or less. Larger organizations require a commercial license. This license automatically converts to MIT two years after each release.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MySqlConnector (>= 2.6.2)
- NPipeline.Connectors (>= 0.54.0)
- NPipeline.StorageProviders (>= 0.54.0)
-
net8.0
- MySqlConnector (>= 2.6.2)
- NPipeline.Connectors (>= 0.54.0)
- NPipeline.StorageProviders (>= 0.54.0)
-
net9.0
- MySqlConnector (>= 2.6.2)
- NPipeline.Connectors (>= 0.54.0)
- NPipeline.StorageProviders (>= 0.54.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.54.0 | 0 | 9/19/2026 |
| 0.53.2 | 94 | 9/9/2026 |
| 0.53.1 | 133 | 6/12/2026 |
| 0.53.0 | 122 | 6/11/2026 |
| 0.52.0 | 118 | 5/30/2026 |
| 0.51.1 | 128 | 5/29/2026 |
| 0.51.0 | 114 | 5/29/2026 |
| 0.50.0 | 131 | 5/29/2026 |
| 0.49.3 | 111 | 5/28/2026 |
| 0.49.2 | 124 | 5/27/2026 |
| 0.49.1 | 110 | 5/27/2026 |
| 0.49.0 | 117 | 5/25/2026 |
| 0.48.3 | 133 | 5/22/2026 |
| 0.48.2 | 111 | 5/19/2026 |
| 0.48.1 | 126 | 5/17/2026 |
| 0.48.0 | 111 | 5/17/2026 |
| 0.47.0 | 114 | 5/16/2026 |
| 0.46.0 | 113 | 5/16/2026 |
| 0.45.0 | 117 | 5/15/2026 |
| 0.44.0 | 109 | 5/14/2026 |