Skip to content

Conversation

tim-haselhoff
Copy link

Fix sqlalchemy returning datetime in python instead of arrow when using arrow

@benedikt-bartscher
Copy link

@kvesteri foremost: thanks for maintaining sqlalchemy-utils. We really enjoyed using it so far.

Is there any way we can get this in? I would love to help if there is anything left to do

@torotil
Copy link
Contributor

torotil commented Jan 10, 2025

I think that this whole part of sqlalchemy-utils needs some work (see #761) … and it seems that there is currently noone around to maintain this code properly (ie. with an opinion on its architecture).

Having said that I had luck getting a bug fix in (#754) by also providing a test case that demonstrates the issue.

@benedikt-bartscher
Copy link

We could add a small test for it if required. @tim-haselhoff wdyt?

Copy link
Collaborator

@kurtmckee kurtmckee left a comment

Choose a reason for hiding this comment

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

There appear to be several unnecessary changes here; the only thing that appears necessary is to add:

        @property
        def python_type(self):
            return Arrow

Please add a unit test to demonstrate that this is resolving a bug.

@@ -1,3 +1,4 @@
from arrow import Arrow
Copy link
Collaborator

Choose a reason for hiding this comment

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

This results in an ImportError if arrow isn't installed; the current architecture is to allow for imports within the sqlalchemy_utils package but only raise an exception if a class is used but the underlying dependency isn't installed.

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.

4 participants