Skip to content

feat: Add Transformer for tables (codegen replacement)#564

Merged
kodiakhq[bot] merged 5 commits intomainfrom
feat/transform
Jan 4, 2023
Merged

feat: Add Transformer for tables (codegen replacement)#564
kodiakhq[bot] merged 5 commits intomainfrom
feat/transform

Conversation

@yevgenypats
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions bot added the feat label Jan 2, 2023
@yevgenypats yevgenypats marked this pull request as ready for review January 3, 2023 16:59
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 3, 2023

⏱️ Benchmark results

  • DefaultConcurrency-2 resources/s: 12,081
  • Glob-2 ns/op: 163.3
  • TablesWithChildrenDefaultConcurrency-2 resources/s: 31,224
  • BufferedScanner-2 ns/op: 10.13
  • LogReader-2 ns/op: 30.72

Copy link
Copy Markdown
Contributor

@hermanschaaf hermanschaaf 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, would definitely be nice to not need codegen! I guess developers will still have to rely on docs generation to see what the output is though, so there is still some codegen in the loop.

I'm also curious to see what the performance of this will be like with hundreds of tables, and whether it will be good enough to run without some kind of caching (cough codegen cough) step :)

Co-authored-by: Herman Schaaf <hermanschaaf@gmail.com>
Copy link
Copy Markdown
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 🚀

Same concerns as @hermanschaaf as we're moving the generation to runtime and also lose some visibility on what's generated.

We should probably have some test that runs on all tables and ensures the transformation works (we don't have mock tests coverage for all plugins). That test could also serve as a benchmark to know how much time it takes to start a plugin

Also to confirm - this removes only the table codegen, but we still need resolvers codegen in each plugin correct?

@@ -0,0 +1,151 @@
package transformers
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖

@disq
Copy link
Copy Markdown
Member

disq commented Jan 4, 2023

Apart from the missing modifiers to add ColumnOptions/PKs, or Resolvers without redefining the whole column, this method of operation removes transparency as to what is actually being generated. There's no way to debug what's happening or no way to use it as a one-time generator (to then edit the result to fit) which in turn makes things more closed and harder to understand.

Co-authored-by: Kemal <223029+disq@users.noreply.github.com>
@yevgenypats
Copy link
Copy Markdown
Contributor Author

Apart from the missing modifiers to add ColumnOptions/PKs, or Resolvers without redefining the whole column, this method of operation removes transparency as to what is actually being generated. There's no way to debug what's happening or no way to use it as a one-time generator (to then edit the result to fit) which in turn makes things more closed and harder to understand.

Indeed this is the downside but to understand what the transformation does it generate the markdown which shows exactly what columns are created after transformation. The otherway around creates an unmaintainable codegen code.

@kodiakhq kodiakhq bot merged commit a643ddf into main Jan 4, 2023
@kodiakhq kodiakhq bot deleted the feat/transform branch January 4, 2023 12:42
kodiakhq bot pushed a commit that referenced this pull request Jan 4, 2023
🤖 I have created a release *beep* *boop*
---


## [1.18.0](v1.17.2...v1.18.0) (2023-01-04)


### Features

* Add Transformer for tables (codegen replacement) ([#564](#564)) ([a643ddf](a643ddf))
* Support conversion of Unix timestamps in timestamptz ([#570](#570)) ([6b948ab](6b948ab))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
yevgenypats added a commit to cloudquery/cloudquery that referenced this pull request Jan 4, 2023
This shouldn't introduce any public facing changes.

This should go together with:
cloudquery/plugin-sdk#564

In general codegen creates a sub-optimal developer experience where you
have to juggle between `codegen` and code to make any code-changes. Not
only it creates a tough experience for the developer it also makes it
hard to review and to contribute.

This take here moves codegen only to the discovery phase and moves the
transformation to be part of the SDK which will eventually deprecate the
`codegen` package from the SDK completely and will avoid having two APIs
which are almost identical but quite the same.
yevgenypats added a commit to cloudquery/cloudquery that referenced this pull request Jan 9, 2023
Similar to #6276 moving
transformation to be part of our SDK
cloudquery/plugin-sdk#564

This is related to cloudquery/plugin-sdk#573 

Few notes on column changes:

most of changes are just additional columns and this should be fine as
we did too much transformation. we want to keep the code simple, focus
on extraction and provide and easy way of doing "dumb" one level
transformation via reflection. The additional column are because we have
in some places a duplicate where we add our own `arn` so it can be
consistent but this is our decision and we still want to be as close as
possible to the API so some duplicates is fine (and it makes the code
simple and consistent).

breaking changes in `aws_docdb_pending_maintenance_actions ` those
apparently never worked and those columns where always empty (they
didn't have mock tests so we didn't catch those)

Co-authored-by: Kemal <223029+disq@users.noreply.github.com>
Co-authored-by: Kemal Hadimli <disq@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants