-
Notifications
You must be signed in to change notification settings - Fork 257
docs(dwh): add bigquery migration guide MTA-6297 #5419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SamyOubouaziz
wants to merge
6
commits into
main
Choose a base branch
from
MTA-6297
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+149
−0
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5fa4a29
docs(dwh): add bigquery migration guide MTA-6297
SamyOubouaziz 04981f7
docs(dwh): update
SamyOubouaziz a2af3e4
docs(dwh): update
SamyOubouaziz 200f404
docs(dwh): update
SamyOubouaziz 001b26a
docs(dwh): update
SamyOubouaziz 61b12d0
Apply suggestions from code review
SamyOubouaziz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| --- | ||
| title: How to migrate data from Google BigQuery | ||
| description: Learn how to migrate data from Google BigQuery to your Scaleway Data Warehouse for ClickHouse® deployment. | ||
| tags: connect migration transfer copy data alternative migrate ClickHouse® integrate integration | ||
| dates: | ||
| validation: 2025-11-05 | ||
| posted: 2025-11-05 | ||
| --- | ||
| import Requirements from '@macros/iam/requirements.mdx' | ||
|
|
||
| This page explains how to migrate anaytical datasets from Google BigQuery to a Scaleway Data Warehouse for ClickHouse® deployment. THe instructions are based on the [official ClickHouse® guide](https://clickhouse.com/docs/migrations/bigquery/migrating-to-clickhouse-cloud) to migrate from Google BigQuery. | ||
|
|
||
| This documentation exemplifies the migration procedure using the [New York Taxi Data](https://clickhouse.com/docs/getting-started/example-datasets/nyc-taxi) provided by ClickHouse®. | ||
|
|
||
| <Requirements /> | ||
|
|
||
| - A Scaleway account logged into the [console](https://console.scaleway.com) | ||
| - [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization | ||
| - A working Google Cloud Provider account with access to BigQuery and Google Cloud Storage. | ||
| - [Created a Data Warehouse for ClickHouse® deployment](/data-warehouse/how-to/create-deployment/). | ||
|
|
||
| ## How to export data from Google BigQuery | ||
|
|
||
| Google BigQuery can only export data to Google CLoud Storage (GCS), so you must copy your data to GCS first, then transfer it from GCS to Scaleway Object Storage before ingesting it to your Data Warehouse for ClickHouse® deployment. | ||
SamyOubouaziz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Exporting BigQuery data to GCS | ||
|
|
||
| 1. Log in to your Google Cloud account, then open BigQuery. | ||
|
|
||
| 2. Use the `EXPORT DATA` statement to export tables to GCS in the `Parquet` format. Make sure to replace `your-bucket-name` with your GCS bucket name: | ||
|
|
||
| ```sql | ||
| EXPORT DATA OPTIONS ( | ||
| uri='gs://your-bucket-name/nyc_taxi_data/*.parquet', | ||
| format='PARQUET', | ||
| overwrite=true | ||
| ) AS | ||
|
|
||
| SELECT * FROM `bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2016`; | ||
| ``` | ||
|
|
||
| <Message type="note"> | ||
| - The `*` in the bucket URI allows Google BigQuery to shard the export into multiple parts if necessary. | ||
| - You must have write access to the specified GCS bucket to perform this action. | ||
| </Message> | ||
|
|
||
| ### Transfering data to Scaleway Object Storage | ||
SamyOubouaziz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| To copy data from Google Cloud Storage (GCS) to Scaleway Object Storage, we recommend using [Rclone](https://rclone.org/), as it is compatible with both Google Cloud Storage and Scaleway Object storage, and allows you to easily copy data from a cloud provider to another. | ||
SamyOubouaziz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 1. Run the command below to install Rclone, or refer to the [official documentation](https://rclone.org/downloads/) for alternative methods: | ||
|
|
||
| ```sh | ||
| curl https://rclone.org/install.sh | sudo bash | ||
| ``` | ||
|
|
||
| 2. Run the command below to start configuring your GCS remote: | ||
| ```sh | ||
| rclone config | ||
| ``` | ||
|
|
||
| 3. Create a new remote, then enter the following parameters when prompted: | ||
| - Name: `gcs` | ||
| - Storage type: `Google Cloud Storage` | ||
| - ID and secret (service account JSON file recommended) | ||
|
|
||
| Your GCS remote for Rclone is now configured. | ||
|
|
||
| 4. Run the command below to start configuring your Scaleway Object Storage remote: | ||
| ```sh | ||
| rclone config | ||
| ``` | ||
|
|
||
| 5. Create a new remote, then enter the following parameters when prompted: | ||
| - Name: `scw` | ||
| - Storage type: `s3` | ||
| - Provider: `Scaleway` | ||
| - Endpoint: `s3.fr-par.scw.cloud` (update according to your preferred region) | ||
| - API access key and secret key | ||
|
|
||
| 6. Run the command below to copy the cotntent of your GCS bucket to your Scaleway Object Storage bucket. Make sure to replace the placeholders with the correct values: | ||
SamyOubouaziz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ```sh | ||
| rclone copy gcs:your-gcs-bucket scw:your-scw-bucket --progress | ||
| ``` | ||
|
|
||
| Your Scaleway Object Storage now contains data exported from Google BigQuery in Parquet format, which can now be ingested into your Data Warehouse for ClickHouse® deployment. | ||
|
|
||
| ## Ingesting data into your Data Warehouse for ClickHouse® deployment | ||
|
|
||
| 1. Connect to your deployment by following the [dedicated documentation](/data-warehouse/how-to/connect-applications/). Alternatively, you can use the ClickHouse® Console from your deployment's **Overview** page. | ||
|
|
||
| 2. Run the command below to create a database and a table to store your new data: | ||
|
|
||
| ```sql | ||
| CREATE DATABASE IF NOT EXISTS nyc_taxi; | ||
|
|
||
| CREATE TABLE nyc_taxi.trips_small | ||
| ( | ||
| pickup_datetime DateTime, | ||
| dropoff_datetime DateTime, | ||
| pickup_ntaname String | ||
| -- Add other relevant columns | ||
| ) | ||
| ENGINE = MergeTree() | ||
| ORDER BY pickup_datetime; | ||
| ``` | ||
|
|
||
| 2. Run the command below Import data from your Scaleway Object Storage bucket. | ||
SamyOubouaziz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```sql | ||
| INSERT INTO nyc_taxi.trips_small | ||
| SELECT | ||
| trip_id, | ||
| pickup_datetime, | ||
| dropoff_datetime, | ||
| pickup_longitude, | ||
| pickup_latitude, | ||
| dropoff_longitude, | ||
| dropoff_latitude, | ||
| passenger_count, | ||
| trip_distance, | ||
| fare_amount, | ||
| extra, | ||
| tip_amount, | ||
| tolls_amount, | ||
| total_amount, | ||
| payment_type, | ||
| pickup_ntaname, | ||
| dropoff_ntaname | ||
| FROM s3( | ||
| '<your_bucket_endpoint>/nyc-taxi/trips_{0..2}.gz', | ||
| 'TabSeparatedWithNames' | ||
| ); | ||
| ``` | ||
|
|
||
| 3. Run the sample query below to make sure your data was properly ingested: | ||
|
|
||
| ```sql | ||
| SELECT | ||
| pickup_ntaname, | ||
| count(*) AS count | ||
| FROM nyc_taxi.trips_small | ||
| WHERE pickup_ntaname != '' | ||
| GROUP BY pickup_ntaname | ||
| ORDER BY count DESC | ||
| LIMIT 10; | ||
| ``` | ||
|
|
||
| Your data is now imported into your Data Warehouse for ClickHouse® deployment. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.