Skip to content

Conversation

@marianogappa
Copy link
Contributor

@marianogappa marianogappa commented Jul 8, 2024

fixes #18490

Implements support for Incremental Table on Typeform's FormResponses table.

Bumps plugin-sdk-python, which enables Python clients to use a StateClient.

Before:

✓ Code/test-typeform-postgres-sync  $ cli sync cloudquery-config                                                      ⏱ 10:35:07
Loading spec(s) from cloudquery-config
Starting sync for: typeform (grpc@localhost:7777) -> [postgresql (cloudquery/postgresql@v8.0.7)]
Sync completed successfully. Resources: 457, Errors: 0, Warnings: 0, Time: 2

Enable PR

git checkout mariano/state-client

After:

✓ Code/test-typeform-postgres-sync  $ cli sync cloudquery-config                                                      ⏱ 10:35:19
Loading spec(s) from cloudquery-config
Starting sync for: typeform (grpc@localhost:7777) -> [postgresql (cloudquery/postgresql@v8.0.7)]
Sync completed successfully. Resources: 20, Errors: 0, Warnings: 0, Time: 1s

@marianogappa marianogappa requested review from a team, hermanschaaf and maaarcelino and removed request for a team July 8, 2024 09:51
@property
def resolver(self):
return FormResponsesResolver(table=self)
return self._resolver
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a dangerous anti-pattern we should be aware of. It was creating a brand new resolver every time the property was being referenced (note that by adding @property, you don't call resolver(), but just resolver).

Copy link

@dkeyer-twilio dkeyer-twilio Jul 10, 2024

Choose a reason for hiding this comment

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

@marianogappa What's the risk of this usage, out of curiosity? Is there a performance hit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dkeyer-twilio oh sorry, I should have been more clear. There's no performance issue.

  • resolver here is acting as a getter, and one doesn't expect a getter to create a brand new object.
  • Objects are stateful. One wouldn't normally expect to set some state on an object and then not have it later.
  • In this case, the .sync() method calls resolver.set_state_client(...), and this method would erase that state.

I think this pattern causes very unintuitive behaviour. I certainly lost an hour on it.

@hermanschaaf
Copy link
Member

Approved, but some tests are failing (seems to be due to the introduction of forced keyword arguments)

@marianogappa marianogappa added the automerge Automatically merge once required checks pass label Jul 8, 2024
@kodiakhq kodiakhq bot merged commit 5127370 into main Jul 8, 2024
@kodiakhq kodiakhq bot deleted the mariano/state-client branch July 8, 2024 12:47
kodiakhq bot pushed a commit that referenced this pull request Jul 9, 2024
🤖 I have created a release *beep* *boop*
---


## [1.5.0](plugins-source-typeform-v1.4.3...plugins-source-typeform-v1.5.0) (2024-07-09)


### Features

* Implement support for Incremental Table on Typeform's FormResponses table ([#18492](#18492)) ([5127370](5127370))


### Bug Fixes

* **deps:** Update dependency cloudquery-plugin-sdk to v0.1.28 ([#18509](#18509)) ([e1cf3ad](e1cf3ad))
* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.12.0 ([#18448](#18448)) ([a5850e1](a5850e1))
* Fix pagination logic for responses on Typeform plugin. ([#18479](#18479)) ([d0923b0](d0923b0))

---
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/plugin/source/typeform automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Incremental table support for Typeform's FormResponses table.

5 participants