5
5
from sqlalchemy import BigInteger , Boolean , Column , Date , DateTime , Float , ForeignKey , Integer , String , case
6
6
from sqlalchemy .dialects import mysql , postgresql , sqlite
7
7
from sqlalchemy .orm import relationship
8
-
9
8
Base = modelBase .Base
10
9
11
10
BigIntegerType = BigInteger ()
12
11
BigIntegerType = BigIntegerType .with_variant (sqlite .INTEGER (), 'sqlite' )
13
12
BigIntegerType = BigIntegerType .with_variant (postgresql .BIGINT (), 'postgresql' )
14
13
BigIntegerType = BigIntegerType .with_variant (mysql .BIGINT (), 'mysql' )
15
14
15
+ DateTimeType = DateTime ()
16
+ DateTimeType = DateTimeType .with_variant (sqlite .INTEGER (), 'sqlite' )
17
+
16
18
17
19
def is_hex (s ):
18
20
try :
@@ -404,9 +406,9 @@ class Results(Base):
404
406
ProcessingLevelID = Column ('processinglevelid' , ForeignKey (ProcessingLevels .ProcessingLevelID ),
405
407
nullable = False )
406
408
ResultDateTime = Column ('resultdatetime' , DateTime )
407
- ResultDateTimeUTCOffset = Column ('resultdatetimeutcoffset' , BigInteger )
409
+ ResultDateTimeUTCOffset = Column ('resultdatetimeutcoffset' , BigIntegerType )
408
410
ValidDateTime = Column ('validdatetime' , DateTime )
409
- ValidDateTimeUTCOffset = Column ('validdatetimeutcoffset' , BigInteger )
411
+ ValidDateTimeUTCOffset = Column ('validdatetimeutcoffset' , BigIntegerType )
410
412
StatusCV = Column ('statuscv' , ForeignKey (CVStatus .Name ), index = True )
411
413
SampledMediumCV = Column ('sampledmediumcv' , ForeignKey (CVMediumType .Name ), nullable = False , index = True )
412
414
ValueCount = Column ('valuecount' , Integer , nullable = False )
@@ -503,7 +505,7 @@ class InstrumentOutputVariables(Base):
503
505
class DataLoggerFileColumns (Base ):
504
506
505
507
DataLoggerFileColumnID = Column ('dataloggerfilecolumnid' , Integer , primary_key = True , nullable = False )
506
- ResultID = Column ('resultid' , BigInteger , ForeignKey (Results .ResultID ))
508
+ ResultID = Column ('resultid' , BigIntegerType , ForeignKey (Results .ResultID ))
507
509
DataLoggerFileID = Column ('dataloggerfileid' , Integer ,
508
510
ForeignKey (DataLoggerFiles .DataLoggerFileID ), nullable = False )
509
511
InstrumentOutputVariableID = Column ('instrumentoutputvariableid' , Integer ,
@@ -861,7 +863,7 @@ class ActionAnnotations(Base):
861
863
class EquipmentAnnotations (Base ):
862
864
863
865
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
864
- EquipmentID = Column ('valueid' , BigInteger , ForeignKey (Equipment .EquipmentID ), nullable = False )
866
+ EquipmentID = Column ('valueid' , BigIntegerType , ForeignKey (Equipment .EquipmentID ), nullable = False )
865
867
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
866
868
867
869
AnnotationObj = relationship (Annotations )
@@ -1640,7 +1642,7 @@ class CategoricalResultValues(Base):
1640
1642
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1641
1643
ResultID = Column ('resultid' , ForeignKey (CategoricalResults .ResultID ), nullable = False )
1642
1644
DataValue = Column ('datavalue' , String (255 ), nullable = False )
1643
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1645
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1644
1646
ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1645
1647
1646
1648
ResultObj = relationship (CategoricalResults )
@@ -1651,7 +1653,7 @@ class MeasurementResultValues(Base):
1651
1653
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1652
1654
ResultID = Column ('resultid' , ForeignKey (MeasurementResults .ResultID ), nullable = False )
1653
1655
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
1654
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1656
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1655
1657
ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1656
1658
1657
1659
ResultObj = relationship (MeasurementResults )
@@ -1661,8 +1663,8 @@ class PointCoverageResultValues(Base):
1661
1663
1662
1664
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1663
1665
ResultID = Column ('resultid' , ForeignKey (PointCoverageResults .ResultID ), nullable = False )
1664
- DataValue = Column ('datavalue' , BigInteger , nullable = False )
1665
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1666
+ DataValue = Column ('datavalue' , BigIntegerType , nullable = False )
1667
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1666
1668
ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1667
1669
XLocation = Column ('xlocation' , Float (53 ), nullable = False )
1668
1670
XLocationUnitsID = Column ('xlocationunitsid' , ForeignKey (Units .UnitsID ), nullable = False )
@@ -1687,7 +1689,7 @@ class ProfileResultValues(Base):
1687
1689
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1688
1690
ResultID = Column ('resultid' , ForeignKey (ProfileResults .ResultID ), nullable = False )
1689
1691
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
1690
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1692
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1691
1693
ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1692
1694
ZLocation = Column ('zlocation' , Float (53 ), nullable = False )
1693
1695
ZAggregationInterval = Column ('zaggregationinterval' , Float (53 ), nullable = False )
@@ -1714,12 +1716,12 @@ class SectionResultValues(Base):
1714
1716
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1715
1717
ResultID = Column ('resultid' , ForeignKey (SectionResults .ResultID ), nullable = False )
1716
1718
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
1717
- ValueDateTime = Column ('valuedatetime' , BigInteger , nullable = False )
1718
- ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , BigInteger , nullable = False )
1719
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1720
+ ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1719
1721
XLocation = Column ('xlocation' , Float (53 ), nullable = False )
1720
1722
XAggregationInterval = Column ('xaggregationinterval' , Float (53 ), nullable = False )
1721
1723
XLocationUnitsID = Column ('xlocationunitsid' , ForeignKey (Units .UnitsID ), nullable = False )
1722
- ZLocation = Column ('zlocation' , BigInteger , nullable = False )
1724
+ ZLocation = Column ('zlocation' , BigIntegerType , nullable = False )
1723
1725
ZAggregationInterval = Column ('zaggregationinterval' , Float (53 ), nullable = False )
1724
1726
ZLocationUnitsID = Column ('zlocationunitsid' , ForeignKey (Units .UnitsID ), nullable = False )
1725
1727
CensorCodeCV = Column ('censorcodecv' , ForeignKey (CVCensorCode .Name ), nullable = False , index = True )
@@ -1750,7 +1752,7 @@ class SpectraResultValues(Base):
1750
1752
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1751
1753
ResultID = Column ('resultid' , ForeignKey (SpectraResults .ResultID ), nullable = False )
1752
1754
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
1753
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1755
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1754
1756
ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1755
1757
ExcitationWavelength = Column ('excitationwavelength' , Float (53 ), nullable = False )
1756
1758
EmissionWavelength = Column ('emmistionwavelength' , Float (53 ), nullable = False )
@@ -1779,7 +1781,7 @@ class TimeSeriesResultValues(Base):
1779
1781
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1780
1782
ResultID = Column ('resultid' , ForeignKey (TimeSeriesResults .ResultID ), nullable = False )
1781
1783
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
1782
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1784
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1783
1785
ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1784
1786
CensorCodeCV = Column ('censorcodecv' , ForeignKey (CVCensorCode .Name ), nullable = False , index = True )
1785
1787
QualityCodeCV = Column ('qualitycodecv' , ForeignKey (CVQualityCode .Name ), nullable = False , index = True )
@@ -1805,7 +1807,7 @@ class TrajectoryResultValues(Base):
1805
1807
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1806
1808
ResultID = Column ('resultid' , ForeignKey (TrajectoryResults .ResultID ), nullable = False )
1807
1809
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
1808
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1810
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1809
1811
ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1810
1812
XLocation = Column ('xlocation' , Float (53 ), nullable = False )
1811
1813
XLocationUnitsID = Column ('xlocationunitsid' , ForeignKey (Units .UnitsID ), nullable = False )
@@ -1850,8 +1852,8 @@ class TransectResultValues(Base):
1850
1852
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1851
1853
ResultID = Column ('resultid' , ForeignKey (TransectResults .ResultID ), nullable = False )
1852
1854
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
1853
- ValueDateTime = Column ('valuedatetime' , DateTime , nullable = False )
1854
- ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , DateTime , nullable = False )
1855
+ ValueDateTime = Column ('valuedatetime' , DateTimeType , nullable = False )
1856
+ ValueDateTimeUTCOffset = Column ('valuedatetimeutcoffset' , Integer , nullable = False )
1855
1857
XLocation = Column ('xlocation' , Float (53 ), nullable = False )
1856
1858
XLocationUnitsID = Column ('xlocationunitsid' , ForeignKey (Units .UnitsID ), nullable = False )
1857
1859
YLocation = Column ('ylocation' , Float (53 ), nullable = False )
@@ -1896,7 +1898,7 @@ class TransectResultValues(Base):
1896
1898
class CategoricalResultValueAnnotations (Base ):
1897
1899
1898
1900
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1899
- ValueID = Column ('valueid' , BigInteger , ForeignKey (CategoricalResultValues .ValueID ), nullable = False )
1901
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (CategoricalResultValues .ValueID ), nullable = False )
1900
1902
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1901
1903
1902
1904
AnnotationObj = relationship (Annotations )
@@ -1906,7 +1908,7 @@ class CategoricalResultValueAnnotations(Base):
1906
1908
class MeasurementResultValueAnnotations (Base ):
1907
1909
1908
1910
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1909
- ValueID = Column ('valueid' , BigInteger , ForeignKey (MeasurementResultValues .ValueID ), nullable = False )
1911
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (MeasurementResultValues .ValueID ), nullable = False )
1910
1912
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1911
1913
1912
1914
AnnotationObj = relationship (Annotations )
@@ -1916,7 +1918,7 @@ class MeasurementResultValueAnnotations(Base):
1916
1918
class PointCoverageResultValueAnnotations (Base ):
1917
1919
1918
1920
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1919
- ValueID = Column ('valueid' , BigInteger , ForeignKey (PointCoverageResultValues .ValueID ), nullable = False )
1921
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (PointCoverageResultValues .ValueID ), nullable = False )
1920
1922
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1921
1923
1922
1924
AnnotationObj = relationship (Annotations )
@@ -1926,7 +1928,7 @@ class PointCoverageResultValueAnnotations(Base):
1926
1928
class ProfileResultValueAnnotations (Base ):
1927
1929
1928
1930
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1929
- ValueID = Column ('valueid' , BigInteger , ForeignKey (ProfileResultValues .ValueID ), nullable = False )
1931
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (ProfileResultValues .ValueID ), nullable = False )
1930
1932
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1931
1933
1932
1934
AnnotationObj = relationship (Annotations )
@@ -1936,7 +1938,7 @@ class ProfileResultValueAnnotations(Base):
1936
1938
class SectionResultValueAnnotations (Base ):
1937
1939
1938
1940
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1939
- ValueID = Column ('valueid' , BigInteger , ForeignKey (SectionResultValues .ValueID ), nullable = False )
1941
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (SectionResultValues .ValueID ), nullable = False )
1940
1942
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1941
1943
1942
1944
AnnotationObj = relationship (Annotations )
@@ -1946,7 +1948,7 @@ class SectionResultValueAnnotations(Base):
1946
1948
class SpectraResultValueAnnotations (Base ):
1947
1949
1948
1950
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1949
- ValueID = Column ('valueid' , BigInteger , ForeignKey (SpectraResultValues .ValueID ), nullable = False )
1951
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (SpectraResultValues .ValueID ), nullable = False )
1950
1952
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1951
1953
1952
1954
AnnotationObj = relationship (Annotations )
@@ -1956,7 +1958,7 @@ class SpectraResultValueAnnotations(Base):
1956
1958
class TimeSeriesResultValueAnnotations (Base ):
1957
1959
1958
1960
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1959
- ValueID = Column ('valueid' , BigInteger , ForeignKey (TimeSeriesResultValues .ValueID ), nullable = False )
1961
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (TimeSeriesResultValues .ValueID ), nullable = False )
1960
1962
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1961
1963
1962
1964
AnnotationObj = relationship (Annotations )
@@ -1966,7 +1968,7 @@ class TimeSeriesResultValueAnnotations(Base):
1966
1968
class TrajectoryResultValueAnnotations (Base ):
1967
1969
1968
1970
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1969
- ValueID = Column ('valueid' , BigInteger , ForeignKey (TrajectoryResultValues .ValueID ), nullable = False )
1971
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (TrajectoryResultValues .ValueID ), nullable = False )
1970
1972
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1971
1973
1972
1974
AnnotationObj = relationship (Annotations )
@@ -1976,7 +1978,7 @@ class TrajectoryResultValueAnnotations(Base):
1976
1978
class TransectResultValueAnnotations (Base ):
1977
1979
1978
1980
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1979
- ValueID = Column ('valueid' , BigInteger , ForeignKey (TransectResultValues .ValueID ), nullable = False )
1981
+ ValueID = Column ('valueid' , BigIntegerType , ForeignKey (TransectResultValues .ValueID ), nullable = False )
1980
1982
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
1981
1983
1982
1984
AnnotationObj = relationship (Annotations )
0 commit comments