Skip to content

fix: Apply schema and record transformations for v2 sources with v3 destinations#13291

Merged
kodiakhq[bot] merged 3 commits intocloudquery:mainfrom
erezrokah:fix/add_record_transformers_source_v2_dest_v3
Aug 23, 2023
Merged

fix: Apply schema and record transformations for v2 sources with v3 destinations#13291
kodiakhq[bot] merged 3 commits intocloudquery:mainfrom
erezrokah:fix/add_record_transformers_source_v2_dest_v3

Conversation

@erezrokah
Copy link
Copy Markdown
Member

@erezrokah erezrokah commented Aug 23, 2023

Summary

Fixes justmiles/cq-source-crowdstrike#5.
We should apply the schema and record transformations when the source is v2 and the destination is v3, otherwise pks are not removed in append mode, sync time and source name columns are not added, etc.

This probably impacts all community/partners plugins as I believe those haven't upgraded to SDK v4.

Tried to do this the less possible ugly way I could think of.
Tested with:

kind: source
spec:
  name: azure
  path: cloudquery/azure
  version: v8.3.0 # v2 source
  destinations: ["bigquery", "postgresql"]
  tables: ["azure_storage_*"]
---
kind: destination
spec:
  name: bigquery
  path: cloudquery/bigquery
  version: "v3.3.0" # v3 destination
  write_mode: "append"
  spec:
    project_id: ****
    dataset_id: ****
---
kind: destination
spec:
  name: "postgresql"
  registry: "github"
  path: "cloudquery/postgresql"
  version: "v4.2.2" # v2 destination
  spec:
    connection_string: ****

@erezrokah erezrokah requested a review from yevgenypats as a code owner August 23, 2023 09:50
@erezrokah erezrokah requested a review from hermanschaaf August 23, 2023 09:50
@cq-bot cq-bot added the cli label Aug 23, 2023
@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Aug 23, 2023
@kodiakhq kodiakhq bot merged commit 5fd5b59 into cloudquery:main Aug 23, 2023
kodiakhq bot pushed a commit that referenced this pull request Aug 23, 2023
🤖 I have created a release *beep* *boop*
---


## [3.14.2](cli-v3.14.1...cli-v3.14.2) (2023-08-23)


### Bug Fixes

* Apply schema and record transformations for v2 sources with v3 destinations ([#13291](#13291)) ([5fd5b59](5fd5b59))
* **deps:** Update github.com/cloudquery/arrow/go/v13 digest to 5b83d4f ([#13203](#13203)) ([b0a4b8c](b0a4b8c))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.5.1 ([#13195](#13195)) ([a184c37](a184c37))
* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.5.2 ([#13262](#13262)) ([5c55aa3](5c55aa3))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@erezrokah erezrokah deleted the fix/add_record_transformers_source_v2_dest_v3 branch August 23, 2023 11:31
kodiakhq bot pushed a commit that referenced this pull request Aug 24, 2023
…3 destinations (#13307)



#### Summary

Follow up to #13291.
Fixes justmiles/cq-source-crowdstrike#5.

v2 sources already add these columns so we shouldn't duplicate them. I didn't catch this during my tests since I already had the tables in the database so the destination skipped creating them.

<!--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Primary Key Error when using with BigQuery

3 participants