Skip to content

Conversation

@mklaber
Copy link
Contributor

@mklaber mklaber commented Jun 15, 2021

Description

As a user with a large QB app who is writing an integration script for just a couple of tables in my app, it doesn't make sense to generate class files for all of the tables in my app. This PR allows users to generate files for only a subset of tables via a new --include argument (that can be specified multiple times to allow multiple tables).

An ancillary benefit is to minimise the risk of re-running the script on an existing client (as described in #29). A user could decide to update just a single table if they really need the changes to that table and don't want to risk updating the whole app.

  • Adds a --include / -i argument to the model-generate script
  • Generates table files for the table(s) specified by the new arg
  • Tests and documents new functionality
  • Updates pytest to allow passing more args to the run_generator fixture

Checklist:

  • Submitting to dev branch
  • pytest tests passing
  • Includes tests to cover the changes
  • flake8 passing
  • Relevant documentation added

* Adds a `--tbl-obj` / `-o` argument to the `model-generate` script
* Generates table files for the table(s) specified by the new arg
* Tests and documents new functionality
* Updates pytest to allow passing more args to the `run_generator` fixture
@tkutcher
Copy link
Owner

Awesome! Great idea. Happy to merge this. I hear you on the naming, but I don't mind the -o. The only other thought I had would be something like --include (or --include-table)/-i. Thoughts on that? Then potential use case in the future to implement the inverse with --exclude if that happens to be relevant.

I am ok with either. So let me know if you like the --include idea and if you want to make that change then I can merge and will publish.

Also left one feedback thing in the review

Thanks again!

@mklaber
Copy link
Contributor Author

mklaber commented Jun 15, 2021

Yea, -i is no worse than -o in terms of using flags that are really common in command line apps. I'll update it.

@mklaber mklaber requested a review from tkutcher June 15, 2021 15:09
@mklaber mklaber marked this pull request as draft June 15, 2021 15:09
@mklaber mklaber marked this pull request as ready for review June 15, 2021 15:14
@tkutcher
Copy link
Owner

Awesome! Thanks again. I will merge and release soon.

@tkutcher tkutcher merged commit 93d1ece into tkutcher:dev Jun 15, 2021
@tkutcher tkutcher changed the title feat: Add --tbl-obj argument to the model-generate script feat: Add --include argument to the model-generate script Jun 15, 2021
@tkutcher tkutcher added this to the v0.3 milestone Jun 15, 2021
tkutcher pushed a commit that referenced this pull request Jun 15, 2021
tkutcher pushed a commit that referenced this pull request Jun 15, 2021
mklaber added a commit to heylohousing/quickbase-client that referenced this pull request Jun 18, 2021
Though tkutcher#40 cuts down on the number of files
generated, it did not cut down on the number of times fields for tables
were requested. This commit moves the "skip" logic to before the
`get_fields_for_table` call. (It also adds pytest-mock in order to
test the change.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants