Upravit

Sdílet prostřednictvím


New-AzStorageBlobQueryConfig

Creates a blob query configuration object, which can be used in Get-AzStorageBlobQueryResult.

Syntax

New-AzStorageBlobQueryConfig
   [-AsCsv]
   [-RecordSeparator <String>]
   [-ColumnSeparator <String>]
   [-QuotationCharacter <Char>]
   [-EscapeCharacter <Char>]
   [-HasHeader]
   [-AsJob]
   [<CommonParameters>]
New-AzStorageBlobQueryConfig
   [-AsJson]
   [-RecordSeparator <String>]
   [-AsJob]
   [<CommonParameters>]

Description

The New-AzStorageBlobQueryConfig cmdlet creates a blob query configuration object, which can be used in Get-AzStorageBlobQueryResult.

Examples

Example 1: Create blob query configures , and query a blob

$inputconfig = New-AzStorageBlobQueryConfig -AsCsv -ColumnSeparator "," -QuotationCharacter """" -EscapeCharacter "\" -RecordSeparator "`n" -HasHeader

$outputconfig = New-AzStorageBlobQueryConfig -AsJson -RecordSeparator "`n" 

$queryString = "SELECT * FROM BlobStorage WHERE Name = 'a'"

$result = Get-AzStorageBlobQueryResult -Container $containerName -Blob $blobName -QueryString $queryString -ResultFile "c:\resultfile.json" -InputTextConfiguration $inputconfig -OutputTextConfiguration $outputconfig -Context $ctx

$result

BytesScanned FailureCount BlobQueryError
------------ ------------ --------------
         449            0

This command first create input configuration object as csv, and output configuration object as json, then use the 2 configurations to query blob.

Parameters

-AsCsv

Indicate to create a Blob Query Configuration for CSV.

Type:SwitchParameter
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AsJson

Indicate to create a Blob Query Configuration for Json.

Type:SwitchParameter
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ColumnSeparator

Optional. The string used to separate columns.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EscapeCharacter

Optional. The char used as an escape character.

Type:Nullable<T>[Char]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HasHeader

Optional. Indicate it represent the data has headers.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-QuotationCharacter

Optional. The char used to quote a specific field.

Type:Char
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RecordSeparator

Optional. The string used to separate records.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

PSBlobQueryTextConfiguration