supabase / wrappers

Postgres Foreign Data Wrapper development framework in Rust.

Home Page:http://fdw.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Correct way of creating the bigquery server without vault

OliverDBA opened this issue · comments

What is the correct syntax for creating a server for BigQuery without Vault usage?
Where do I enter the json file with the credentials or the private key in this call?

create server bigquery_server
foreign data wrapper bigquery_wrapper
options (
sa_key '
{
"type": "service_account",
"project_id": "your_gcp_project_id",
...
}
',
project_id 'your_gcp_project_id',
dataset_id 'your_gcp_dataset_id'
);

Using the above code results in
parse service account key JSON failed: Bad service account key: key must be a string at line 6 column 7

when querying the remote table

The sa_key option is the place you should put in the credentials. It should be an valid JSON string which you can download from GCP -> IAM -> Service Account -> Keys page. Below is an example, note the carriage return in private key needs be replaced with \n:

create server bigquery_server
  foreign data wrapper bigquery_wrapper
  options (
    sa_key '
{
  "type": "service_account",
  "project_id": "your_gcp_project_id",
  "private_key_id": "e03f8e03f8e03f8e03f8e03f8e03f8e03f8",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCfaDB7pK/fmP/I\n7IusSK8lTCBnPZghqIbVLt2QHYAMoEF1CaF4F4rxo2vl1Mt8gwsq4T3osQFZMvnL\nYHb7KNyUoJgTjLxJQADv2u4Q3U38heAzK5Tp4ry4MCnuyJIqAPK1GiruwEq4zQrx\n+WzVix8otO37SuW9tzklqlNGMiAYBL0TBKHvS5XMbjP1idBMB8erMz29w/TVQnEB\nKj0vCdZjrbVPKygptt5kcSrL5f4xCZwU+ufz7cp0GLwpRMJ+shG9YJJFBxb0itPF\nsy51vAyEtdBC7jgAU96ZVeQ06nryDq1D2EpoVMElqNyL46Jo3lnKbGquGKzXzQYU\nBN32/scDAgMBAAECggEBAJE/mo3PLgILo2YtQ8ekIxNVHmF0Gl7w9IrjvTdH6hmX\nHI3MTLjkmtI7GmG9V/0IWvCjdInGX3grnrjWGRQZ04QKIQgPQLFuBGyJjEs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wjz+OcALRBBGTaiF2pLn6IhSzNI2sy/tXX8q8dBlg9\nOFCrqT/emes3KytTPfa5NZtYeQ==\n-----END PRIVATE KEY-----\n",
  "client_email": "sa@your_gcp_project_id.iam.gserviceaccount.com",
  "client_id": "0744074407440744",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/sa%40your_gcp_project_id.iam.gserviceaccount.com"
}
   ',
    project_id 'your_gcp_project_id',
    dataset_id 'your_gcp_dataset_id'
  );