Skip to content

Conversation

@piercefreeman
Copy link
Owner

@piercefreeman piercefreeman commented Sep 7, 2025

We default our python types to the Postgres standard types (python int to postgres integer). But on the postgres side these values are only i32 by default. BIGINT is required as an explicit type definition to unlock the 64bit values. We add support for explicitly selecting the decorator type:

class TestModel(TableBase):
        id: int = Field(primary_key=True)
        # This should be BIGINT instead of INTEGER due to explicit_type
        big_number: int = Field(explicit_type=ColumnType.BIGINT)
        # This should be TEXT instead of VARCHAR due to explicit_type
        long_text: str = Field(explicit_type=ColumnType.TEXT)
        # This should be JSONB instead of JSON due to explicit_type
        data: dict = Field(is_json=True, explicit_type=ColumnType.JSONB)
        # Normal field without explicit_type for comparison
        normal_field: str = Field()

@piercefreeman piercefreeman force-pushed the feature/support-typehint-overrides branch from 47eff76 to 1b36b89 Compare September 7, 2025 20:13
@piercefreeman piercefreeman merged commit cb2e663 into main Sep 7, 2025
6 checks passed
@piercefreeman piercefreeman deleted the feature/support-typehint-overrides branch September 7, 2025 20:16
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