DapperLib / DapperLib/Dapper

Using dapper with snowflake connection

Open
#1,814 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

Something broke since v2.0.90 when connecting dapper to snowflake. It now thinks all dates/ and datetimes are ascistrings and the snowflake connector is unable to parse the values.

I am not sure if this is a dapper thing, or a snowflake thing, but I do know that downgrading dapper to from 2.0.123 back to 2.0.90 solves the issue. Because of that I think this is a dapper issue.

I know the exception is coming from snowflake, but after debugging the sources, I have found that dapper is providing the wrong datatype for dates and datetime to the Snowflake db connector.

System.NotImplementedException
The method or operation is not implemented.
at Snowflake.Data.Core.SFDataConverter.csharpTypeValToSfTypeVal(DbType srcType, Object srcVal)
at Snowflake.Data.Client.SnowflakeDbCommand.convertToBindList(List1 parameters) at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteInternalAsync(CancellationToken cancellationToken, Boolean describeOnly) at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 418 at FtpService.SnowflakeRepository.GetActivities(DateTime fromDate) in C:\Users\JonWilson\RiderProjects\ApiService\FtpService\SnowflakeRepository.cs:line 33 at ApiServiceTests.FtpServiceTest.DoShit() in C:\Users\JonWilson\RiderProjects\ApiService\ApiServiceTests\FtpServiceTest.cs:line 22 at Xunit.Sdk.TestInvoker1.<>c__DisplayClass48_1.<b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 264

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Dapper/SqlMapper.Async.cs line 418 and compare parameter handling with the reported version change from 2.0.90 to 2.0.123. Reproduce the failure using SnowflakeRepository.cs line 33 and FtpServiceTest.cs line 22 with DateTime values; done means the Snowflake query accepts date and datetime parameters without the reported conversion exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.