Skip to content

Syrx/Syrx.Snowflake

Syrx.Snowflake

MIT License

This repository contains the Snowflake implementation for the Syrx framework. Syrx is a .NET database abstraction framework that decouples repository code from underlying data stores while emphasizing control, speed, flexibility, testability, extensibility, and readability.

WARNING
This implementation is a work in progress. It has not been tested against a real-world instance of Snowflake as yet. We believe that fundamentally it should work but that we haven't yet tested it in the wild means that this is not yet production ready.
Use at your own risk.

Overview

Syrx.Snowflake provides database connectivity and command execution for Snowflake databases through the Syrx framework. It includes:

  • Syrx.Commanders.Databases.Connectors.Snowflake: Core connector implementing IDatabaseConnector
  • Syrx.Commanders.Databases.Connectors.Snowflake.Extensions: Dependency injection extensions
  • Syrx.Snowflake: Main package for Snowflake support
  • Syrx.Snowflake.Extensions: Simplified configuration extensions

Installation

Package Manager

Install-Package Syrx.Snowflake.Extensions

.NET CLI

dotnet add package Syrx.Snowflake.Extensions

PackageReference

<PackageReference Include="Syrx.Snowflake.Extensions" Version="2.4.6" />

Quick Start

Configuration

services.UseSyrx(builder => builder
    .UseSnowflake(snowflake => snowflake
        .AddConnectionString("snowflake", "Account=myaccount;User=myuser;Password=mypassword;Database=mydatabase;Schema=myschema;Warehouse=mywarehouse")
        .AddCommand(types => types
            .ForType<UserRepository>(methods => methods
                .ForMethod(nameof(UserRepository.GetAllAsync), command => command
                    .UseConnectionAlias("snowflake")
                    .UseCommandText("SELECT * FROM Users"))))));

Repository Implementation

public class UserRepository(ICommander<UserRepository> commander)
{
    private readonly ICommander<UserRepository> _commander = commander;
    
    public async Task<IEnumerable<User>> GetAllAsync() 
        => await _commander.QueryAsync<User>();
    
    public async Task<User?> GetByIdAsync(int id) 
        => (await _commander.QueryAsync<User>(new { id })).SingleOrDefault();
    
    public async Task<bool> CreateAsync(User user) 
        => await _commander.ExecuteAsync(user) > 0;
}

Features

  • Database Abstraction: Clean separation between business logic and data access
  • Performance: Built on Dapper for optimal performance
  • Testability: Fully mockable interfaces for comprehensive testing
  • Flexibility: Easy switching between different database providers
  • Configuration: Fluent API for easy setup and configuration

Dependencies

  • .NET 8.0
  • Snowflake.Data (4.8.0)
  • Syrx.Commanders.Databases framework

Credits

This implementation follows the same patterns and conventions established in other Syrx database providers. Special thanks to the Syrx framework team for creating a robust and extensible architecture.

License

This project is licensed under the MIT License - see the license.txt file for details.

About

Snowflake specific components for Syrx

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages