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

Method save a record being an instance #39

Open
ghost opened this issue Nov 1, 2021 · 2 comments
Open

Method save a record being an instance #39

ghost opened this issue Nov 1, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ghost
Copy link

ghost commented Nov 1, 2021

Feature description::

Currently to save a record in a table:

person_1 = Person(first_name="Teste 1", last_name="teste lastname", age=19, salary=5000)

person_1 = await Person.save(person_1)

This issue wants to add a new way to save, making it easier for the user:

person_1 = Person(first_name="Teste 1", last_name="teste lastname", age=19, salary=5000)

await person_1.save()

Need:

Make it easier for the user to save a new record.

@ghost ghost added enhancement New feature or request good first issue Good for newcomers labels Nov 1, 2021
@DThiebaud
Copy link

The "person_1 = " in "await( Person.save(person1)" is unnecessary. This can be written as
"await Person.save(person1)" or "await person1.save(person1)". However, person1 must be passed as a parameter to save because methods in Python do not have a hidden parameter of the object.

@ghost
Copy link
Author

ghost commented Jan 5, 2022

Thanks for the contribution @DThiebaud !

I understand your point. I see this could be useful, as it would be simpler to code await person_1.save() than await Person.save(person_1).

Don't you see the need for it ?

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
None yet
Development

No branches or pull requests

1 participant