Skip to content

fix: use default values when loading fixtures with missing columns - #1434

Open
mlbiche wants to merge 1 commit into
piccolo-orm:masterfrom
mlbiche:fix-fixtures-default
Open

mlbiche wants to merge 1 commit into
piccolo-orm:masterfrom
mlbiche:fix-fixtures-default

Conversation

@mlbiche

@mlbiche mlbiche commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

This PR fixes an issue when columns with default values are missing in a loaded fixtures file.

Closes #1432

@UsmanGhias UsmanGhias left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there! This is a really nice fix for the fixture loading logic. Utilizing column.get_default_value() instead of hardcoding None ensures that optional columns properly fall back to their defined schema defaults when omitted from input files.

From a technical standpoint, I appreciate how clean the diff is. It integrates smoothly with the existing Pydantic model creation flow in piccolo/utils/pydantic.py. The added test coverage in test_dump_load.py alongside the schema updates in the mega app tables gives me a lot of confidence that this behaves correctly across different database types.

One minor thing to keep an eye on is making sure dynamic callables used as defaults (like timestamps or UUID generators) evaluate as expected during the Pydantic validation phase, but overall this looks solid and ready to ship.

Best,
Usman

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.

Fixtures are inserted with null values while default values can be used

2 participants