Commit 35984fcd authored by CEVAER's avatar CEVAER

Adapted ORM to new schema (source and file fields in Track)

parent b3d7805f
......@@ -176,14 +176,18 @@ class SMOSAcq(Base):
# Track table
class Track(Base):
__tablename__ = "Track"
sid = Column(String(), primary_key=True, index=True, unique=True)
sid = Column(String(), primary_key=True, index=True)
source = Column(String(), primary_key=True, index=True)
file = Column(String(), nullable=False)
name = Column(String(), index=True)
startdate = Column(TIMESTAMP)
stopdate = Column(TIMESTAMP)
vmax = Column(Integer())
geom = Column(Geography('Polygon'))
simpletracks = relationship("SimpleTrack", back_populates="track")
simpletracks_cyclone = relationship("SimpleTrack", primaryjoin="and_(Track.sid==SimpleTrack.sid, "
"Track.source==SimpleTrack.source, Track.source=='atcf')",
backref="track_cyclone")
# The two following relationship should give the same results, but one is using
# precomputed table, the other computes the intersection on the fly in the request.
......@@ -207,12 +211,14 @@ class Track(Base):
class SimpleTrack(Base):
__tablename__ = "SimpleTrack"
sid = Column(String(), ForeignKey('Track.sid'), primary_key=True, index=True)
sid = Column(String(), primary_key=True, index=True)
source = Column(String(), primary_key=True)
date = Column(TIMESTAMP, primary_key=True, index=True)
vmax = Column(Float())
geom = Column(Geography(), index=True)
track = relationship("Track", back_populates="simpletracks")
__table_args__ = (ForeignKeyConstraint(['sid', 'source'],
['Track.sid', 'Track.source']), {})
basin = relationship("Basin",
primaryjoin="func.ST_Intersects(foreign(SimpleTrack.geom), Basin.geom).as_comparison(1, 2)",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment