pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/fastapi/sqlmodel/discussions/696

origen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-0fcd9af82350aeda.css" /> how to use JSON type in sqlmodel , Problem with openapi.json, File "pydantic\json.py", line 90, in pydantic.json.pydantic_encoder TypeError: Object of type 'Column' is not JSON serializable · fastapi/sqlmodel · Discussion #696 · GitHub
Skip to content
Discussion options

You must be logged in to vote

Iam posting this to avoid the same mistake by other
The issue was in another line of code, where i missed the Field

    created_on: datetime =Column(
        DateTime(timezone=True),
        server_default=func.now()
        )
    updated_on: datetime = Column(
        DateTime(timezone=True),
        server_default=func.now(),
        server_onupdate=func.now()
        )

corrected code is as follows

    created_on: datetime = Field(sa_column=Column(
        DateTime(timezone=True),
        server_default=func.now()
        ))
    updated_on: datetime = Field(sa_column=Column(
        DateTime(timezone=True),
        server_default=func.now(),
        server_onupdate=func.now()
        ))

Replies: 6 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@muscodev
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by muscodev
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy