Opened 4 years ago
Closed 3 years ago
#1467 closed defect (fixed)
Oracle should use the native interval type for the sqlalchemy interval type in the same way postgresql does
| Reported by: | guest | Owned by: | zzzeek |
|---|---|---|---|
| Priority: | medium | Milestone: | 0.6.0 |
| Component: | oracle | Severity: | minor - half an hour |
| Keywords: | oracle interval | Cc: | |
| Progress State: | completed/closed |
Description
As of cx_Oracle 5.0, the Oracle engine supports a native interval type and it should be used instead of a timestamp. Postgresql has support for this in sqlalchemy and it should be extended to Oracle. This will also help reflection as oracle interval types do not like being bound to timestamp types.
Change History (4)
comment:1
Changed 4 years ago by guest
comment:2
follow-up:
↓ 3
Changed 4 years ago by zzzeek
- Milestone set to 0.6.0
- Severity changed from no triage selected yet to minor - half an hour
this is targeted towards 0.6 and should probably be dynamically modified based on the detected version of cx_oracle, as well as the version of Oracle actually present (unless Oracle has it going back to 8)
comment:3
in reply to:
↑ 2
Changed 4 years ago by guest
If cx_Oracle version is >= 5.0 released 12/13/2008 then all supported versions of Oracle have a native interval type. Oracle versions < 9i circa 2001 do not have a native interval type.
Replying to zzzeek:
this is targeted towards 0.6 and should probably be dynamically modified based on the detected version of cx_oracle, as well as the version of Oracle actually present (unless Oracle has it going back to 8)
comment:4
Changed 3 years ago by zzzeek
- Progress State changed from awaiting triage to completed/closed
- Resolution set to fixed
- Status changed from new to closed
seems like we can only get INTERVAL DAY TO SECOND going for now. YEAR TO MONTH seems fairly pointless and I couldn't get it to work with cx_oracle as of yet. r756ebcc798c9

a couple of quick and dirty patches to get things going
sqlalchemy-0.5.4p2/lib/sqlalchemy/databases/oracle.py
146,149d145
< class OracleInterval?(sqltypes.Interval):
< def get_col_spec(self):
< return "INTERVAL"
<
294d289
< sqltypes.Interval : OracleInterval?,
sqlalchemy-0.5.4p2/lib/sqlalchemy/types.py
823,825c823
< import sqlalchemy.databases.oracle as oracle
< self.supported = {pg.PGDialect:pg.PGInterval, oracle.OracleDialect:oracle.OracleInterval}
< del oracle
---