fixer-m / snowflake-db-net-client

Snowflake .NET Client
Apache License 2.0
51 stars 14 forks source link

Populating property to DateTime from DateTime truncates milliseconds. #20

Closed gnikeht closed 2 years ago

gnikeht commented 2 years ago

Lets say I have the following table: CREATE TABLE MY_TABLE( Id Number, CreateDate DateTime)

I have the following class: public class MyClass { public int Id {get; set;} public DateTime CreateDate {get; set;} }

I have inserted values with milliseconds in the database and they show up in the database as: 1,3/25/2022 10:34:34.123

If I execute: var result = await _client.QueryAsync<MyClass>("SELECT * FROM MY_TABLE WHERE ID=1;") result.CreateDate comes back as 3/25/2022 10:34:34.000

fixer-m commented 2 years ago

Hi!

That's weird, I can't reproduce this. Can you please get a raw response and ensure that raw value actually contains milliseconds?

var rawResponse = await _client.QueryRawResponseAsync("SELECT * FROM MY_TABLE WHERE ID=1;");
var dateTimeCellValue = rawResult.Rows[0][1]; // should have milliseconds (.123)

In case of 2022-03-25 10:34:34.123 it should return exactly 1648204474.123000000.

gnikeht commented 2 years ago

This can be closed, truncation occurred before actually writing to snowflake. There was no issue.

fixer-m commented 2 years ago

Ok - good.