# Configure dynamic GCS destination based on postgres schema and table

**URL:** <https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609>\
**Category:** CloudQuery Plugins\
**Created:** [November 1, 2023, 1:16pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609 "2023-11-01T13:16:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![helping-wahoo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@helping-wahoo](https://community.cloudquery.io/u/helping-wahoo)\
**Post date:** [November 1, 2023, 1:16pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609/1 "2023-11-01T13:16:40Z")

</div>

Hey all, I’m looking at setting up a PostgreSQL → GCS extract. I have both pieces working, but I was wondering if there’s a way to configure the GCS destination based on the table/schema of the PostgreSQL?

I would like the path to look something like:

```auto
path/to/file/<postgres_schema>/<postgres_table>/*.csv

```

for that table. It looks like I could do this if I made a source/destination for each table, but that seems rather cumbersome.

---

<div class="post-metadata">

**Author:** ![yevgenyp](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@yevgenyp](https://community.cloudquery.io/u/yevgenyp)\
**Post date:** [November 1, 2023, 1:18pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609/2 "2023-11-01T13:18:34Z")

</div>

Hi! I believe that right now the `pg` source only works by syncing one schema only, so you would need to set up a source and destination per schema, and then you can have the above structure.

---

<div class="post-metadata">

**Author:** ![helping-wahoo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@helping-wahoo](https://community.cloudquery.io/u/helping-wahoo)\
**Post date:** [November 1, 2023, 1:20pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609/3 "2023-11-01T13:20:01Z")

</div>

I’m currently only syncing the public schema. What’s the configuration to change the path for each table?

---

<div class="post-metadata">

**Author:** ![yevgenyp](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@yevgenyp](https://community.cloudquery.io/u/yevgenyp)\
**Post date:** [November 1, 2023, 1:21pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609/4 "2023-11-01T13:21:53Z")

</div>

Check out [this](https://hub.cloudquery.io/plugins/destination/cloudquery/gcs/v3.4.10/docs). The `path` can be `postgre_schema/`, and then it will create each table in its own file if this is what you are looking for.

---

<div class="post-metadata">

**Author:** ![helping-wahoo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@helping-wahoo](https://community.cloudquery.io/u/helping-wahoo)\
**Post date:** [November 1, 2023, 1:24pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609/5 "2023-11-01T13:24:24Z")

</div>

I don’t think so, I’m looking to have each table be in its own directory in GCS. As in: if I have two tables: ‘actions’ and ‘orders’. The path in GCP for actions would be:

```auto
gs://bucket-name/path/to/file/actions/actions.csv

```

and for orders:

```auto
gs://bucket-name/path/to/file/orders/orders.csv

```

Is that possible?

---

<div class="post-metadata">

**Author:** ![yevgenyp](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@yevgenyp](https://community.cloudquery.io/u/yevgenyp)\
**Post date:** [November 1, 2023, 1:25pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609/6 "2023-11-01T13:25:24Z")

</div>

I see. I believe this is not possible right now. Can you open an issue please? What is the reason that `gs://bucket-name/path/to/file/actions.csv` wouldn’t work?

---

<div class="post-metadata">

**Author:** ![helping-wahoo](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@helping-wahoo](https://community.cloudquery.io/u/helping-wahoo)\
**Post date:** [November 1, 2023, 1:36pm UTC](https://community.cloudquery.io/t/configure-dynamic-gcs-destination-based-on-postgres-schema-and-table/609/7 "2023-11-01T13:36:51Z")

</div>

Sure! I use the directories as a basis for organization currently within our data lake. I suppose it’s mostly convenience and organization. But in general, some mild templating for the destination could be helpful, especially if it includes a timestamp of when the sync runs.

And thanks for your help!  
[GitHub Issue #15097](https://github.com/cloudquery/cloudquery/issues/15097)
