Skip to content
Discussion options

You must be logged in to vote

Finally activating my brain and search :

	private static ParquetSchema BuildSchema(DbDataReader r)
	{		
		var fields = new List<DataField>(r.FieldCount);
		var schema = r.GetColumnSchema();
		for (int i = 0; i < r.FieldCount; i++)
		{
			if (schema[i].DataTypeName=="date")
			{
				fields.Add(new DateTimeDataField(r.GetName(i), DateTimeFormat.Date, isNullable: schema[i].AllowDBNull));
			}
			else
			{
				fields.Add(new DataField(
					r.GetName(i),
					r.GetFieldType(i),
					schema[i].AllowDBNull));
			}	
		}
		return new ParquetSchema(fields);
	}

Do the trick :-)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aloneguid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant