Closed onyxfish closed 9 months ago
Yes, that is the SQLA behavior in the absence of database native interval type: http://docs.sqlalchemy.org/en/rel_1_0/core/type_basics.html#sql-standard-types
class sqlalchemy.types.Interval(native=True, second_precision=None, day_precision=None) "... The Interval type deals with datetime.timedelta objects. In PostgreSQL, the native INTERVAL type is used; for others, the value is stored as a date which is relative to the “epoch” (Jan. 1, 1970). ..."
So someone using a database other then Postgres is going to be dealing in dates if they are using SQLA as the ORM to build and manipulate tables and data, outside of agate-sql. More likely is that they are going to be using a char field of some type with an interval string or a two column approach with an interval_qty field(some number type) and an interval_desc field(char field). In other words for case one, '3 days ' and in the second case 3, 'days'. In all cases sqlite is going to be the outlier, as its type system is flexible :)
Got it. I'm just going to leave this ticket open as documentation for the time being. The longer-term solution is probably just to add a list of database-specific details to the real docs.
@aklaver Btw, are you on Twitter? I wanted to credit you publicly for your work on this release, but couldn't find you there. (No worries if you're not interested, I just try to make sure folks get attention for their contributions.)
No. I tried it for awhile, never caught on with me.
@aklaver Got it. Your name in the docs/commit history will have to do then. :+1:
I'm not clear what would need to be added to the documentation to close this issue. As no one else has raised any similar issue in many years, I'll close.
Intervals get converted to datetime
FYI @aklaver. Not sure there is much we can do about this. I've excluded it from the tests for the time being.