Ejemplo n.º 1
0
        // Creates a new empty table in Google BigQuery
        public void CreateBigQueryTable(string projectName, string dataSetName, string tableName)
        {
            if (_DataTypeMap == null)
            {
                throw new Exception("DataTypeMap can not be null. Call UploadTableToStorage() or MapColumnTypes() method first");
            }

            BigqueryClient client = BigqueryClient.Create(projectName, _GoogleAPICredential);

            // Build the schema with Google's schema object and our DataTypeMap
            TableSchemaBuilder sBuilder = new TableSchemaBuilder();

            for (int i = 0; i < _DataTypeMap.Keys.Count; i++)
            {
                sBuilder.Add(_DataTypeMap[i].ColumnName, _DataTypeMap[i].BQColumnType);
            }

            // Create the dataset if it doesn't exist.
            BigqueryDataset dataset = client.GetOrCreateDataset(dataSetName);
            BigqueryTable   table   = dataset.GetOrCreateTable(tableName, sBuilder.Build());
        }
Ejemplo n.º 2
0
 // [START create_dataset]
 public void CreateDataset(string datasetId, BigqueryClient client)
 {
     var dataset = client.GetOrCreateDataset(datasetId);
 }