Replies: 4 comments
-
|
I haven't thought of this yet, but it makes sense to implement 👍 . I've found some docs on implementing custom types in sqlalchemy. Similar to pydantic support (#175), I expect I'll need a few preview releases to iron out the kinks. Until I get to this though, you'll have to use Another note: your second code snippet shows Pydantic, I assume. Are you using these formats as well, or are they just illustrative? This because whenever's pydantic pupport is currently limited to the ISO-like format. |
Beta Was this translation helpful? Give feedback.
-
|
Thats great! I believe that a "translation" to Alchemy (and allow Alembic to create automatic migrations) would be an awesome feature for this package because we would only depend on it! As for you question: it was my bad, its just an illustrative result that I made quickly, I'll fix it😅 |
Beta Was this translation helpful? Give feedback.
-
|
You can add a TypeDecorator as documented here https://docs.sqlalchemy.org/en/20/core/custom_types.html Then if you have a base class you can make it automatic with: Which allows a simpler |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @aquarhead, this certainly looks doable. It'll take a while before I get to this though, as I'm currently focussing on getting the main API ready for a 1.0 release. THe code above shows there's at least a fairly straightforward workaround |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
Looking through packages we found yours and we found it very interesting for what we are building right now! Our only concern is if it can also replace
datetimewhen using it withSQL Alchemy(I did not found anything related in docs), so here is a small example:With this small code we can use
alembicto create migrations and manage our database freely and easily. Also, when we recover it from the database, we can freely do:Does it work the same way with
wheneveror I would need to convert fromdatetimetowheneverafter the recovery?edit: fixed my second example return to ISO 8601 just to be clearer.
Beta Was this translation helpful? Give feedback.
All reactions