Skip to content

fix(gcp-resources): Add version to PKs of gcp_cloudiot_device_configs#6551

Merged
kodiakhq[bot] merged 3 commits intocloudquery:mainfrom
erezrokah:fix/gcp_cloudiot_device_configs_pks
Jan 10, 2023
Merged

fix(gcp-resources): Add version to PKs of gcp_cloudiot_device_configs#6551
kodiakhq[bot] merged 3 commits intocloudquery:mainfrom
erezrokah:fix/gcp_cloudiot_device_configs_pks

Conversation

@erezrokah
Copy link
Copy Markdown
Member

Summary

gcp_cloudiot_device_configs used the parent resource name as PK (and project_id). Those are not good enough as it means we can only have 1 config per device. Since there isn't a good field to use for uniqueness it's better to use _cq_id

@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Jan 9, 2023
@cq-bot cq-bot added the gcp label Jan 9, 2023
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 9, 2023

This PR has the following changes to source plugin(s) tables:

  • Table gcp_cloudiot_device_configs: primary key constraint added to column version

@yevgenypats
Copy link
Copy Markdown
Contributor

Good catch. Isn't the version + device_name is the right pk? per docs - https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices.configVersions ?

@erezrokah
Copy link
Copy Markdown
Member Author

Good catch. Isn't the version + device_name is the right pk? per docs -

I was thinking about that too. But it doesn't say the version is unique per device (though I'd expect it to be). It only says it is set by the server

@erezrokah erezrokah force-pushed the fix/gcp_cloudiot_device_configs_pks branch from eae3d46 to 1c100e9 Compare January 10, 2023 09:40
@erezrokah erezrokah changed the title fix(gcp-resources): Remove project_id and device_name as PKs of gcp_cloudiot_device_configs fix(gcp-resources): Add project_id, device_name and version as PKs of gcp_cloudiot_device_configs Jan 10, 2023
@erezrokah erezrokah changed the title fix(gcp-resources): Add project_id, device_name and version as PKs of gcp_cloudiot_device_configs fix(gcp-resources): Add version to PKs of gcp_cloudiot_device_configs Jan 10, 2023
@erezrokah erezrokah force-pushed the fix/gcp_cloudiot_device_configs_pks branch from 1c100e9 to 69a8dd9 Compare January 10, 2023 09:48
@erezrokah erezrokah force-pushed the fix/gcp_cloudiot_device_configs_pks branch from 69a8dd9 to 47a9821 Compare January 10, 2023 09:49
@erezrokah
Copy link
Copy Markdown
Member Author

Good catch. Isn't the version + device_name is the right pk? per docs -

OK so let's try with version. If it's not unique we can drop the PKs

@kodiakhq kodiakhq bot merged commit 12252c3 into cloudquery:main Jan 10, 2023
erezrokah pushed a commit that referenced this pull request Jan 10, 2023
🤖 I have created a release *beep* *boop*
---


##
[6.1.1](plugins-source-gcp-v6.1.0...plugins-source-gcp-v6.1.1)
(2023-01-10)


### Bug Fixes

* **gcp-resources:** Add `organization_id` and `name` as PK of
`gcp_resourcemanager_folders`
([#6547](#6547))
([3c0e702](3c0e702))
* **gcp-resources:** Add `project_id` and `id` as PKs of
`gcp_bigquery_datasets`
([#6532](#6532))
([fd00133](fd00133))
* **gcp-resources:** Add `project_id` and `id` as PKs of
`gcp_bigquery_tables`
([#6533](#6533))
([523c84f](523c84f))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_domains_registrations`
([#6537](#6537))
([47c87b4](47c87b4))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_functions_functions`
([#6538](#6538))
([8552503](8552503))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_iam_deny_policies`
([#6539](#6539))
([d230ede](d230ede))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_iam_service_account_keys`, remove `service_account_unique_id` from
PKs ([#6541](#6541))
([00ca437](00ca437))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_kms_crypto_keys`
([#6542](#6542))
([3d4d03c](3d4d03c))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_kms_keyrings`
([#6543](#6543))
([fbde9e4](fbde9e4))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_run_locations`
([#6548](#6548))
([88c1993](88c1993))
* **gcp-resources:** Add `project_id` and `name` as PKs of
`gcp_run_services`
([#6549](#6549))
([237e28d](237e28d))
* **gcp-resources:** Add `project_id` as PK of `gcp_logging_metrics`
([#6544](#6544))
([599b935](599b935))
* **gcp-resources:** Add `project_id` as PK of `gcp_logging_sinks`
([#6545](#6545))
([d183b51](d183b51))
* **gcp-resources:** Add `version` to PKs of
`gcp_cloudiot_device_configs`
([#6551](#6551))
([12252c3](12252c3))
* **gcp-resources:** Change `gcp_appengine_firewall_ingress_rules` PK to
`_cq_id` ([#6531](#6531))
([5d87911](5d87911))
* **gcp-resources:** Remove `bucket_name` as PK of
`gcp_storage_bucket_policies`
([#6550](#6550))
([fb6a2de](fb6a2de))
* **gcp-resources:** Remove `metadata` from `gcp_aiplatform_models`
([#6529](#6529))
([e068e19](e068e19))

---
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 Jan 11, 2023
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.

3 participants