Skip to content

Conversation

@marianogappa
Copy link
Contributor

Adds a new transformation kind to the basic transformer that enables renaming tables.

Used like:

      - kind: change_table_names
        tables: ["*"]
        new_table_name_template: "c_{{.OldName}}"

Unfortunately, sync_v3 has to be updated to support this transformation, because the sync process deletes stale rows, and it supplies the old table names, and there's no way to ask the transformer how did you change the names.

Therefore, I added a very small tableNameChanger that learns table name changes by sniffing schema bytes on TransformSchema calls (via MigrateTableMessage), and updates the names where it needs to.

Screenshot 2024-08-02 at 15 03 53 Screenshot 2024-08-02 at 15 04 02 Screenshot 2024-08-02 at 15 04 27

@marianogappa marianogappa marked this pull request as ready for review August 2, 2024 14:09
@marianogappa marianogappa requested review from a team, erezrokah and jon-s58 and removed request for a team August 2, 2024 14:09
Copy link
Member

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, added a few comments

@marianogappa marianogappa requested a review from erezrokah August 2, 2024 14:51
@marianogappa marianogappa added the automerge Automatically merge once required checks pass label Aug 2, 2024
@kodiakhq kodiakhq bot merged commit 67d3701 into main Aug 2, 2024
@kodiakhq kodiakhq bot deleted the mariano/add-table-name-changes-to-basic-transformer branch August 2, 2024 15:24
kodiakhq bot pushed a commit that referenced this pull request Aug 5, 2024
🤖 I have created a release *beep* *boop*
---


## [6.3.0](cli-v6.2.0...cli-v6.3.0) (2024-08-05)


### Features

* Implement transformations support. ([#18669](#18669)) ([2af93ed](2af93ed))
* Support table name changes on basic transformer. ([#18833](#18833)) ([67d3701](67d3701))


### Bug Fixes

* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.12.6 ([#18828](#18828)) ([3a48c89](3a48c89))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.57.1 ([#18830](#18830)) ([605c202](605c202))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.58.0 ([#18839](#18839)) ([6b57bca](6b57bca))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.58.1 ([#18852](#18852)) ([4320340](4320340))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
kodiakhq bot pushed a commit that referenced this pull request Aug 5, 2024
🤖 I have created a release *beep* *boop*
---


## 1.0.0 (2024-08-05)


### Features

* Implement basic transformer (add/remove/obfuscate columns) ([#18704](#18704)) ([704102f](704102f))
* Support table name changes on basic transformer. ([#18833](#18833)) ([67d3701](67d3701))


### Bug Fixes

* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.12.0 ([#18448](#18448)) ([a5850e1](a5850e1))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v2 to v4 ([#18822](#18822)) ([bfd8765](bfd8765))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v2 to v4 ([#18842](#18842)) ([39beee4](39beee4))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.57.0 ([#18821](#18821)) ([ef364a2](ef364a2))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.57.1 ([#18830](#18830)) ([605c202](605c202))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.58.0 ([#18839](#18839)) ([6b57bca](6b57bca))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.58.1 ([#18852](#18852)) ([4320340](4320340))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli area/plugin/transformer/basic automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants