> ## Documentation Index
> Fetch the complete documentation index at: https://artie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GCP CloudSQL

> Learn how to configure GCP CloudSQL for PostgreSQL as a source in Artie, including service account creation, publication setup, and enabling logical decoding.

## Creating a service account

```sql theme={null}
CREATE USER artie_transfer WITH PASSWORD 'password';

GRANT USAGE ON SCHEMA schema_name TO artie_transfer;
-- Grant access to existing tables
GRANT SELECT ON ALL TABLES IN SCHEMA schema_name TO artie_transfer;
-- Grant read-only access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT SELECT ON TABLES TO artie_transfer;

-- The replication role does not have enough permissions to create publications. 
-- So you will need to create this as well.
CREATE PUBLICATION dbz_publication FOR ALL TABLES WITH (publish_via_partition_root = true);

ALTER USER artie_transfer REPLICATION;
```

## Turning on Logical Decoding Flag

Steps to turn on logical decoding:

1. Find your database instance and click `Edit`
2. Navigate to `Flags` and find and set `cloudsql.logical_decoding`  to `On`

<img src="https://mintcdn.com/artie/cR74rDu7gj_LCvTI/assets/cloudsql_enable_logical_decoding.png?fit=max&auto=format&n=cR74rDu7gj_LCvTI&q=85&s=18b4076339f0a67889d4f05d9333b89a" alt="CloudSQL Logical Decoding" width="849" height="1200" data-path="assets/cloudsql_enable_logical_decoding.png" />
