public PSBlobQueryCsvTextConfiguration(BlobQueryCsvTextOptions config) { this.RecordSeparator = config.RecordSeparator; this.ColumnSeparator = config.ColumnSeparator; this.QuotationCharacter = config.QuotationCharacter; this.EscapeCharacter = config.EscapeCharacter; this.HasHeaders = config.HasHeaders; this.Type = BlobQueryConfigType.Csv; }
public async Task QueryAsync_QueryTextConfigurations() { await using DisposingContainer test = await GetTestContainerAsync(); BlockBlobClient blockBlobClient = InstrumentClient(test.Container.GetBlockBlobClient(GetNewBlobName())); Stream stream = CreateDataStream(Constants.KB); await blockBlobClient.UploadAsync(stream); // Act string query = @"SELECT _2 from BlobStorage WHERE _1 > 250;"; BlobQueryCsvTextOptions csvTextConfiguration = new BlobQueryCsvTextOptions { ColumnSeparator = ",", QuotationCharacter = '"', EscapeCharacter = '\\', RecordSeparator = "\n", HasHeaders = false }; BlobQueryJsonTextOptions jsonTextConfiguration = new BlobQueryJsonTextOptions { RecordSeparator = "\n" }; BlobQueryOptions options = new BlobQueryOptions { InputTextConfiguration = csvTextConfiguration, OutputTextConfiguration = jsonTextConfiguration }; // Act Response <BlobDownloadInfo> response = await blockBlobClient.QueryAsync( query, options); using StreamReader streamReader = new StreamReader(response.Value.Content); string s = await streamReader.ReadToEndAsync(); // Assert Assert.AreEqual("{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n{\"_1\":\"400\"}\n", s); }