fix: Don't multiplex subscriptions#2018
Conversation
Not sure about that, maybe since we have the subscriptions already we can make it a top level table |
plugins/source/azure/resources/services/subscriptions/locations.go
Outdated
Show resolved
Hide resolved
plugins/source/azure/resources/services/subscriptions/subscriptions.go
Outdated
Show resolved
Hide resolved
plugins/source/azure/resources/services/subscriptions/locations.go
Outdated
Show resolved
Hide resolved
5bb0f00 to
69f55f9
Compare
69f55f9 to
d167add
Compare
| Multiplex: client.SingleSubscriptionMultiplex, | ||
| Columns: []schema.Column{ | ||
| { | ||
| Name: "subscription_id", |
There was a problem hiding this comment.
Subscriptions already have the id in ID so no need for subscription_id
|
@hermanschaaf marked this as ready and made you reviewer :) I mad the minimal changes to fix the bug and I think we can do the relations bit if we feel that's the right approach, or required by users. |
hermanschaaf
left a comment
There was a problem hiding this comment.
@erezrokah Looks good 👍 I couldn't test it locally the other day due to some unrelated local environment issues, but this fixes the bug so let's not block on that--we can always revisit if something still doesn't work right.
🤖 I have created a release *beep* *boop* --- ## [1.0.2-pre.0](plugins-source-azure-v1.0.1-pre.0...plugins-source-azure-v1.0.2-pre.0) (2022-10-03) ### Bug Fixes * **deps:** Update module github.com/cloudquery/plugin-sdk to v0.11.2 ([#2162](#2162)) ([5701aa5](5701aa5)) * **deps:** Update module github.com/cloudquery/plugin-sdk to v0.11.4 ([#2210](#2210)) ([760d0a6](760d0a6)) * **deps:** Update module github.com/cloudquery/plugin-sdk to v0.11.5 ([#2227](#2227)) ([7db2dde](7db2dde)) * Don't multiplex subscriptions ([#2018](#2018)) ([94d43b3](94d43b3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
Fixes #1947
We shouldn't be multiplexing subscriptions as the API returns all subscriptions. So we were basically getting all subscriptions for each subscription, and then using the client subscription id to set the value in the DB. Since we use
IDas the primary key and do an upsert (at least in v2), the last operation is the one that "took".I think this also means subscription locations should not be multiplexed either and be a relation of subscriptions.Most of the changes are to support relations in the new SDK list pager API.
Removed the relations stuff to simplify things
Still a draft as needs some cleanup, which I'll do next weekDone
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)