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

Ability to disable implicit field creation #923

Closed
cancan101 opened this issue Aug 23, 2018 · 4 comments
Closed

Ability to disable implicit field creation #923

cancan101 opened this issue Aug 23, 2018 · 4 comments

Comments

@cancan101
Copy link

Add an option to disable implicit field creation. I have been burned on this when using ModelSchema where a field changes name such that there is now a field with the old name an an auto generated field with the new name leading two duplicate fields.

@deckar01
Copy link
Member

Can you provide an example?

@cancan101
Copy link
Author

I shouldn't say duplicate. I should just say a Schema which is silently using the wrong name.

Originally my model is:

class Widget(Model):
    ...
    other_id = ...

and then I have:

class WidgetSchema(ModelSchema):
   class Meta:
     model = Widget
     fields = ('other_id')

and then other_id gets renamed in the Model. The Schema code doesn't get updated. Now there is an implicit other_id which is not using the nicely autogenerated field that ModelSchema would otherwise make.

@lafrech
Copy link
Member

lafrech commented Aug 23, 2018

IIUC, this is a marshmallow-sqlalchemy issue.

But since it could affect any other marshmallow-whatever-database lib, and since the fix could be in marshmallow anyway, it makes sense to discuss it here.

@sloria
Copy link
Member

sloria commented Mar 30, 2021

Let's move forward with #1356 .

@sloria sloria closed this as completed Mar 30, 2021
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

No branches or pull requests

4 participants