external help file | Module Name | online version | schema |
---|---|---|---|
pwshCloudflare-help.xml |
pwshCloudflare |
2.0.0 |
Executes a SQL query against a Cloudflare D1 database.
Invoke-CFD1Query [-Name <String>] [-Id <String>] [-AccountId <String>] -Query <String>
[-QueryParams <String[]>] [<CommonParameters>]
Invoke-CFD1Query [-Name <String>] [-Id <String>] [-AccountName <String>] -Query <String>
[-QueryParams <String[]>] [<CommonParameters>]
Executes a SQL query against a Cloudflare D1 database. Must include a query as well as the account name or id as well as the database name or id.
$Query = 'CREATE TABLE IF NOT EXISTS users (id integer PRIMARY KEY AUTOINCREMENT, userName text NOT NULL);'
Invoke-CFD1Query -AccountName 'myAccount' -Name 'myDb' -Query $Query
Creates a 'users' table in the 'myDb' database.
$Query = "INSERT INTO users (userName) VALUES ('JohnDoe');"
Invoke-CFD1Query -AccountName 'myAccount' -Name 'myDb' -Query $Query
Inserts a user with username 'JohnDoe' into the 'users' table of the 'myDb' database.
$Query = 'SELECT ?1 FROM users;'
$QueryParams = @('JohnDoe')
Invoke-CFD1Query -AccountName 'myAccount' -Name 'myDb' -Query $Query -QueryParams $QueryParams
Returns the user with username 'JohnDoe' from the 'users' table of the 'myDb' database.
The name of the database to query.
Type: String
Parameter Sets: (All)
Aliases: DatabaseName
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The ID of the database to query.
Type: String
Parameter Sets: (All)
Aliases: DatabaseId
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The ID of the account that owns the database.
Type: String
Parameter Sets: AccountId
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The name of the account that owns the database.
Type: String
Parameter Sets: AccountName
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The SQL query to execute.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The parameters to pass to the query.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable, and -ProgressAction. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
https://github.com/connorcarnes/pwshCloudflare
https://developers.cloudflare.com/api/operations/cloudflare-d1-query-database
https://developers.cloudflare.com/d1/platform/client-api
https://developers.cloudflare.com/d1/learning/querying-json/