Skip to content
similarwebPublic

About

LinqToDB adapter for Firebolt

Resources

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

Firebolt LinqToDB driver

Motivation

Currently, there are no official LinqToDB driver for Firebolt. This leads to following issues:

  • usage of direct SQL queries instead of Linq expressions;
  • overcomplicated infrastructure around ADO.NET classes;
  • can't use variety of ORMs and features/extensions;
  • devs have to write all SQL queries, even simple ones like SELECT * FROM table.

Goals

Providing a LinqToDB driver for Firebolt will simplify usage of DB for newcomers.

Limitations

Currently, it is an MVP to narrow down the scope of the project.

  • No support for LinqToDB features like InsertOrUpdate, InsertOrReplace, etc.;
  • Not all Firebolt-specific functions are supported (e.g. geospatial, DataSketches, etc.);
  • No support for Schema retrieval (yet);
  • Some other issues could be present, but they are not critical for current goal.

Target platforms

  • NET8 (8.0.414) — backporting
  • NET9 (9.0.305) — mainstream

Dogfooding

We in Similarweb are using this package. This would encourage us to constantly improve it.

Supported versions

  • Firebolt: tested on Firebolt v2 only (v1 is deprecated / untested).
    • Install FireboltNetSDK 1.9.1 or 1.10.x yourself (peer dependency; not bundled).
  • LinqToDB: 6.0 – 6.4 (one nupkg; dependency linq2db >= 6.0.0).
    • Materialized CTE (AsMaterializedCte): name-suffix + BuildWithClause fallback when built against < 6.3; native IsMaterialized when built against ≥ 6.3. The published package is built against 6.0.0 (suffix fallback).
    • CI matrix: linq2db {6.0.0, 6.1.0, 6.2.0, 6.3.0, 6.4.0} × FireboltNetSDK {1.9.1, 1.10.1} × TFM {net8.0, net9.0}.

How to use

  1. Install this package (see how to install)

  2. Add FireboltNetSDK package since this implementation uses same way of loading ADO.NET classes, as LinqToDB;

  3. In your code add:

    Registration.AddDataProvider(); // this will register Firebolt provider
    var options = new DataOptions()
        .UseConnectionString(Registration.DataProviderName, connectionString);
    var db = new DataConnection(options);
    // here you may use `db` as usual LinqToDB connection
  4. In case you want real LinqToDB features, you should use db.GetTable<T>() method to get table as LinqToDB table. For example:

    var table = db.GetTable<YourEntity>();
    var result = table.Where(x => x.Id == 1).ToList();

Installing package

Using .NET CLI

dotnet add package Similarweb.LinqToDB.Firebolt

Using Visual Studio UI

Tools > NuGet Package Manager > Manage NuGet Packages for Solution and search for Similarweb.LinqToDB.Firebolt

Using Rider UI

Tools > NuGet > Manage NuGet packages for <solution name> and search for Similarweb.LinqToDB.Firebolt

Using Package Manager Console:

Install-Package Similarweb.LinqToDB.Firebolt

About

LinqToDB adapter for Firebolt

Resources

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages