Skip to content

Conversation

rsbh
Copy link
Contributor

@rsbh rsbh commented Feb 4, 2021

Check List

  • Tests has been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet

This changes will add support to pass extraParams objects while creating the schema from tables.
I am using generateFilesByTableNames function to dynamically generate schema for all the tables but I have to manually add dataSource to the schema files after generating.
This change will add options to pass dataSource along with other params to the cube schema file

@rsbh rsbh requested a review from a team as a code owner February 4, 2021 10:04
@github-actions github-actions bot added the pr:community Contribution from Cube.js community members. label Feb 4, 2021
@rsbh rsbh changed the title add support for dataSource field in generating schema for tables. add support for extra params in generating schema for tables. Feb 6, 2021
@ovr
Copy link
Member

ovr commented Feb 10, 2021

Hello @rbsh,

I have created PR in which I added support to the generateFilesByTableNames function to take extraParams as an argument and add it to the generated schema.
we can pass this dataSource option to generateFilesByTableNames function and it will generate schemas as per cli dataSource

Can you please rebase your branch? And start calling generateFilesByTableNames with passing dataSource inside cli and DevServer?

Small notice:

Don't forget that ScaffoldingTemplate is not a part of public API and can be changed without BC.

Thanks!

@rsbh
Copy link
Contributor Author

rsbh commented Feb 10, 2021

Hey @ovr , what will be 2nd argument for generateFilesByTableNames function ?
dataSource of type string or extraParams object with dataSource ?

Thanks for the notice. I will lock the version for this package.

@ovr
Copy link
Member

ovr commented Feb 10, 2021

dataSource of type string or extraParams object with dataSource ?

I think it's better to use an object, and call it something like schemaContext

@rsbh
Copy link
Contributor Author

rsbh commented Feb 11, 2021

Hey @ovr, I am done with the changes. You can review the PR.

@ovr ovr merged commit a9b3df2 into cube-js:master Feb 11, 2021
@ovr
Copy link
Member

ovr commented Feb 11, 2021

Thank you @rsbh for contribution! 🍰 🥮

igorlukanin pushed a commit that referenced this pull request Feb 16, 2021
* feat(schema-compiler): add support for `dataSource` field in scaffolding template

* refactor: replace dataSource with extraParams object

* refactor: set extraParams to empty object as default arg

* chore: fix test failure due to merge issue

* feat: pass dataSource to generateFilesByTableNames in cli and DevServer

* refactor: fix lint issues in test file

* refactor: rename extraParams to schemaContext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:community Contribution from Cube.js community members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants