You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What operating system and processor architecture are you using?
Windows 10, x64
What version of .NET framework are you using?
.net framework 4.8
What did you do?
Mainly :
var reader = cmd.ExecuteReader();
var dt = new DataTable();
dt.Load(reader);
cmd is a SnowflakeDbCommand with a simple query : SELECT MyVariantcolumn FROM T
dt.Load(reader) raise an exception : Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
What did you expect to see?
No exception
Can you set logging to DEBUG and collect the logs?
For variant rowType.length is 0, should be -1 for unknown.
Replace L124 by : row[SchemaTableColumn.ColumnSize] = rowType.length == 0 ? -1: (int)rowType.length;
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Dataset load with VARIANT in resultset lead to ConstraintException
SNOW-1618183: Dataset load with VARIANT in resultset lead to ConstraintException
Aug 8, 2024
hi - thanks for reporting this issue and all the details (and the suggested solution too!)
managed to reproduce it as you described; we'll take a look and fix it.
i also observed that using reader.Read(), something like:
...cmd.CommandText="SELECT variantcol from test_db.dotnet.gh1006;";IDataReaderreader=cmd.ExecuteReader();while(reader.Read()){Console.WriteLine(reader.GetString(0));}
...
did not crash the application and could return the resultset; so perhaps could be used as a workaround until the issue is fixed, of course only if that makes sense in your case.
Anyways; thank you again and I'll keep this issue posted with the progress as there's any.
Same issue seems to be happening with ARRAY data types in the result.
One workaround is to specify the columns on the DataTable (generated from the results) before loading the data into it
IDataReader reader = cmd.ExecuteReader();
var table = new DataTable();
for (int i = 0; i < reader.FieldCount; i++)
{
table.Columns.Add(reader.GetName(i), reader.GetFieldType(i));
}
table.Load(reader);
This loaded the ARRAY columns as (serialized) strings.
What version of .NET driver are you using?
4.1.0
What operating system and processor architecture are you using?
Windows 10, x64
What version of .NET framework are you using?
.net framework 4.8
What did you do?
Mainly :
cmd is a SnowflakeDbCommand with a simple query : SELECT MyVariantcolumn FROM T
dt.Load(reader) raise an exception : Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
No exception
This came from ColumnSize
For variant rowType.length is 0, should be -1 for unknown.
Replace L124 by :
row[SchemaTableColumn.ColumnSize] = rowType.length == 0 ? -1: (int)rowType.length;
The text was updated successfully, but these errors were encountered: