< Back
Export-GcSqlInstance
Post
NAME Export-GcSqlInstance
SYNOPSIS
Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump or CSV file.
SYNTAX
Export-GcSqlInstance [-Project <string>] [-Instance] <string> [-CloudStorageDestination] <string> [-SchemaOnly
<SwitchParameter>] [-Database <string[]>] [-Table <string[]>] [<CommonParameters>]
Export-GcSqlInstance [-Project <string>] [-Instance] <string> [-CloudStorageDestination] <string> [-SelectQuery]
<string> [-Database <string[]>] [<CommonParameters>]
DESCRIPTION
Exports data from the specified Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump or CSV file.
Defaults to a SQL file, but if the CSV Parameter set is used it will export as a CSV file.
PARAMETERS
-Project <string>
Name of the project. Defaults to the Cloud SDK configuration for properties if not specified. ///
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Instance <string>
The name of the instance to have data exported.
Required? true
Position? 0
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CloudStorageDestination <string>
The path to the file in Google Cloud Storage where the export will be stored. The URI is in the form
"gs://bucketName/fileName."
If the file already exists, the operation will fail.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SchemaOnly <SwitchParameter>
Export only schemas.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-SelectQuery <string>
The select query used to extract the data. If this is used, a CSV file will be exported, rather than SQL.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Database <string[]>
Databases (for example, "guestbook" or "orders") from which the export is made. If fileType is SQL and no
database is specified, all databases are exported. If fileType is CSV, you can optionally specify at most one
database to export. If exporting as CSV and selectQuery also specifies the database, this field will be
ignored.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Table <string[]>
Tables to export, or that were exported, from the specified database. If you specify tables, specify one and
only one database.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
---------- EXAMPLE 1 ----------
PS C:\\> Export-GcSqlInstance "myInstance" "gs://bucket/file.gz"
Exports the databases inside the instance "myInstance" to the Cloud Storage bucket file "gs://bucket/file.gz" as a
MySQL dump file.
---------- EXAMPLE 2 ----------
PS C:\\> Export-GcSqlInstance "myInstance" "gs://bucket/file.csv" "SELECT * FROM data.table"
Exports the databases inside the instance "myInstance" to the Cloud Storage bucket file "gs://bucket/file.csv" as
a CSV file with the select query "SELECT * FROM data.table"
---------- EXAMPLE 3 ----------
PS C:\\> Export-GcSqlInstance "myInstance" "gs://bucket/file.csv" -Database "myData","myData2"
Exports the databases "myData" and "myData2" inside the instance "myInstance" to the Cloud Storage bucket file
"gs://bucket/file.gz" as a MySQL dump file.
RELATED LINKS
[How-To: Importing and Exporting] (https://cloud.google.com/tools/powershe ... ort-export)
[Overview of Importing and Exporting] (https://cloud.google.com/sql/docs/import-export/)
SYNOPSIS
Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump or CSV file.
SYNTAX
Export-GcSqlInstance [-Project <string>] [-Instance] <string> [-CloudStorageDestination] <string> [-SchemaOnly
<SwitchParameter>] [-Database <string[]>] [-Table <string[]>] [<CommonParameters>]
Export-GcSqlInstance [-Project <string>] [-Instance] <string> [-CloudStorageDestination] <string> [-SelectQuery]
<string> [-Database <string[]>] [<CommonParameters>]
DESCRIPTION
Exports data from the specified Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump or CSV file.
Defaults to a SQL file, but if the CSV Parameter set is used it will export as a CSV file.
PARAMETERS
-Project <string>
Name of the project. Defaults to the Cloud SDK configuration for properties if not specified. ///
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Instance <string>
The name of the instance to have data exported.
Required? true
Position? 0
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CloudStorageDestination <string>
The path to the file in Google Cloud Storage where the export will be stored. The URI is in the form
"gs://bucketName/fileName."
If the file already exists, the operation will fail.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SchemaOnly <SwitchParameter>
Export only schemas.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-SelectQuery <string>
The select query used to extract the data. If this is used, a CSV file will be exported, rather than SQL.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Database <string[]>
Databases (for example, "guestbook" or "orders") from which the export is made. If fileType is SQL and no
database is specified, all databases are exported. If fileType is CSV, you can optionally specify at most one
database to export. If exporting as CSV and selectQuery also specifies the database, this field will be
ignored.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Table <string[]>
Tables to export, or that were exported, from the specified database. If you specify tables, specify one and
only one database.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
---------- EXAMPLE 1 ----------
PS C:\\> Export-GcSqlInstance "myInstance" "gs://bucket/file.gz"
Exports the databases inside the instance "myInstance" to the Cloud Storage bucket file "gs://bucket/file.gz" as a
MySQL dump file.
---------- EXAMPLE 2 ----------
PS C:\\> Export-GcSqlInstance "myInstance" "gs://bucket/file.csv" "SELECT * FROM data.table"
Exports the databases inside the instance "myInstance" to the Cloud Storage bucket file "gs://bucket/file.csv" as
a CSV file with the select query "SELECT * FROM data.table"
---------- EXAMPLE 3 ----------
PS C:\\> Export-GcSqlInstance "myInstance" "gs://bucket/file.csv" -Database "myData","myData2"
Exports the databases "myData" and "myData2" inside the instance "myInstance" to the Cloud Storage bucket file
"gs://bucket/file.gz" as a MySQL dump file.
RELATED LINKS
[How-To: Importing and Exporting] (https://cloud.google.com/tools/powershe ... ort-export)
[Overview of Importing and Exporting] (https://cloud.google.com/sql/docs/import-export/)