Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced object creation, using column references #268

Open
dantownsend opened this issue Sep 23, 2021 · 0 comments
Open

Enhanced object creation, using column references #268

dantownsend opened this issue Sep 23, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@dantownsend
Copy link
Member

When instantiating a Table object, we do this (like in 99% of ORMs):

Band(name="Pythonistas", popularity=1000)

Some Piccolo queries allow you to pass in a dictionary mapping column references to values, instead of using kwargs. It's nice for tab completion, and also for catching errors.

Band.update({
    Band.popularity: 2000
}).run_sync()

It would be good to have this ability for instantiating objects too. Something like:

Band(_data={Band.name: "Pythonistas", Band.popularity: 2000})
@dantownsend dantownsend added enhancement New feature or request good first issue Good for newcomers labels Sep 23, 2021
@dantownsend dantownsend added this to To do in Enhancements via automation Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Development

No branches or pull requests

1 participant