1313BigIntegerType = BigIntegerType .with_variant (mysql .BIGINT (), 'mysql' )
1414
1515
16-
17-
18-
1916def is_hex (s ):
2017 try :
2118 int (s , base = 16 )
@@ -1212,6 +1209,7 @@ class MethodCitations(Base):
12121209 RelationshipTypeCV = Column ('relationshiptypecv' , ForeignKey (CVRelationshipType .Name ), nullable = False ,
12131210 index = True )
12141211 CitationID = Column ('citationid' , ForeignKey (Citations .CitationID ), nullable = False )
1212+
12151213 CitationObj = relationship (Citations )
12161214 MethodObj = relationship (Methods )
12171215
@@ -1278,7 +1276,6 @@ class RelatedResults(Base):
12781276# ################################################################################
12791277class PointCoverageResults (Results ):
12801278
1281-
12821279 ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
12831280 ZLocation = Column ('zlocation' , Float (53 ))
12841281 ZLocationUnitsID = Column ('zlocationunitsid' , ForeignKey (Units .UnitsID ))
@@ -1296,12 +1293,11 @@ class PointCoverageResults(Results):
12961293 IntendedYSpacingUnitsObj = relationship (Units , primaryjoin = 'PointCoverageResults.IntendedYSpacingUnitsID == Units.UnitsID' )
12971294 SpatialReferenceObj = relationship (SpatialReferences )
12981295 ZLocationUnitsObj = relationship (Units , primaryjoin = 'PointCoverageResults.ZLocationUnitsID == Units.UnitsID' )
1299- # ResultObj = relationship(Results, primaryjoin='PointCoverageResults.ResultID == Results.ResultID')
1300- __mapper_args__ = {'polymorphic_identity' :'Point coverage' }
13011296
1297+ __mapper_args__ = {'polymorphic_identity' : 'Point coverage' }
13021298
1303- class ProfileResults (Results ):
13041299
1300+ class ProfileResults (Results ):
13051301
13061302 ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
13071303 XLocation = Column ('xlocation' , Float (53 ))
@@ -1321,12 +1317,11 @@ class ProfileResults(Results):
13211317 SpatialReferenceObj = relationship (SpatialReferences )
13221318 XLocationUnitsObj = relationship (Units , primaryjoin = 'ProfileResults.XLocationUnitsID == Units.UnitsID' )
13231319 YLocationUnitsObj = relationship (Units , primaryjoin = 'ProfileResults.YLocationUnitsID == Units.UnitsID' )
1324- # ResultObj = relationship(Results, primaryjoin='ProfileResults.ResultID == Results.ResultID')
1325- __mapper_args__ = {'polymorphic_identity' :'Profile Coverage' }
13261320
1321+ __mapper_args__ = {'polymorphic_identity' : 'Profile Coverage' }
13271322
1328- class CategoricalResults (Results ):
13291323
1324+ class CategoricalResults (Results ):
13301325
13311326 ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
13321327 XLocation = Column ('xlocation' , Float (53 ))
@@ -1343,8 +1338,7 @@ class CategoricalResults(Results):
13431338 YLocationUnitsObj = relationship (Units , primaryjoin = 'CategoricalResults.YLocationUnitsID == Units.UnitsID' )
13441339 ZLocationUnitsObj = relationship (Units , primaryjoin = 'CategoricalResults.ZLocationUnitsID == Units.UnitsID' )
13451340
1346- # ResultObj = relationship(Results, primaryjoin='CategoricalResults.ResultID == Results.ResultID')
1347- __mapper_args__ = {'polymorphic_identity' :'Category coverage' }
1341+ __mapper_args__ = {'polymorphic_identity' :' Category coverage' }
13481342
13491343
13501344class TransectResults (Results ):
@@ -1365,12 +1359,11 @@ class TransectResults(Results):
13651359 IntendedTransectSpacingUnitsObj = relationship (Units , primaryjoin = 'TransectResults.IntendedTransectSpacingUnitsID == Units.UnitsID' )
13661360 SpatialReferenceObj = relationship (SpatialReferences )
13671361 ZLocationUnitsObj = relationship (Units , primaryjoin = 'TransectResults.ZLocationUnitsID == Units.UnitsID' )
1368- # ResultObj = relationship(Results, primaryjoin='TransectResults.ResultID == Results.ResultID')
1369- __mapper_args__ = {'polymorphic_identity' :'Transect Coverage' }
13701362
1363+ __mapper_args__ = {'polymorphic_identity' : 'Transect Coverage' }
13711364
1372- class SpectraResults (Results ):
13731365
1366+ class SpectraResults (Results ):
13741367
13751368 ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
13761369 XLocation = Column ('xlocation' , Float (53 ))
@@ -1390,7 +1383,7 @@ class SpectraResults(Results):
13901383 XLocationUnitsObj = relationship (Units , primaryjoin = 'SpectraResults.XLocationUnitsID == Units.UnitsID' )
13911384 YLocationUnitsObj = relationship (Units , primaryjoin = 'SpectraResults.YLocationUnitsID == Units.UnitsID' )
13921385 ZLocationUnitsObj = relationship (Units , primaryjoin = 'SpectraResults.ZLocationUnitsID == Units.UnitsID' )
1393- # ResultObj = relationship(Results, primaryjoin='SpectraResults.ResultID == Results.ResultID')
1386+
13941387 __mapper_args__ = {'polymorphic_identity' :'Spectra coverage' }
13951388
13961389
@@ -1409,14 +1402,13 @@ class TimeSeriesResults(Results):
14091402 AggregationStatisticCV = Column ('aggregationstatisticcv' , ForeignKey (CVAggregationStatistic .Name ),
14101403 nullable = False , index = True )
14111404
1412- # ResultObj = relationship(Results)
14131405 IntendedTimeSpacingUnitsObj = relationship (Units ,
1414- primaryjoin = 'TimeSeriesResults.IntendedTimeSpacingUnitsID == Units.UnitsID' )
1406+ primaryjoin = 'TimeSeriesResults.IntendedTimeSpacingUnitsID == Units.UnitsID' )
14151407 SpatialReferenceObj = relationship (SpatialReferences )
14161408 XLocationUnitsObj = relationship (Units , primaryjoin = 'TimeSeriesResults.XLocationUnitsID == Units.UnitsID' )
14171409 YLocationUnitsObj = relationship (Units , primaryjoin = 'TimeSeriesResults.YLocationUnitsID == Units.UnitsID' )
14181410 ZLocationUnitsObj = relationship (Units , primaryjoin = 'TimeSeriesResults.ZLocationUnitsID == Units.UnitsID' )
1419- # ResultObj = relationship(Results, primaryjoin='TimeSeriesResults.ResultID == Results.ResultID')
1411+
14201412 __mapper_args__ = {'polymorphic_identity' :'Time series coverage' }
14211413
14221414
@@ -1440,13 +1432,12 @@ class SectionResults(Results):
14401432 IntendedZSpacingUnitsObj = relationship (Units , primaryjoin = 'SectionResults.IntendedZSpacingUnitsID == Units.UnitsID' )
14411433 SpatialReferenceObj = relationship (SpatialReferences )
14421434 YLocationUnitsObj = relationship (Units , primaryjoin = 'SectionResults.YLocationUnitsID == Units.UnitsID' )
1443- # ResultObj = relationship(Results, primaryjoin='SectionResults.ResultID == Results.ResultID')
1435+
14441436 __mapper_args__ = {'polymorphic_identity' :'Section coverage' }
14451437
14461438
14471439class TrajectoryResults (Results ):
14481440
1449-
14501441 ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
14511442 SpatialReferenceID = Column ('spatialreferenceid' , ForeignKey (SpatialReferences .SpatialReferenceID ))
14521443 IntendedTrajectorySpacing = Column ('intendedtrajectoryspacing' , Float (53 ))
@@ -1460,13 +1451,12 @@ class TrajectoryResults(Results):
14601451 IntendedTrajectorySpacingUnitsObj = relationship (Units ,
14611452 primaryjoin = 'TrajectoryResults.IntendedTrajectorySpacingUnitsID == Units.UnitsID' )
14621453 SpatialReferenceObj = relationship (SpatialReferences )
1463- # ResultObj = relationship(Results, primaryjoin='TrajectoryResults.ResultID == Results.ResultID')
1454+
14641455 __mapper_args__ = {'polymorphic_identity' :'Trajectory coverage' }
14651456
14661457
14671458class MeasurementResults (Results ):
14681459
1469-
14701460 ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
14711461 XLocation = Column ('xlocation' , Float (53 ))
14721462 XLocationUnitsID = Column ('xlocationunitsid' , ForeignKey (Units .UnitsID ))
@@ -1488,7 +1478,7 @@ class MeasurementResults(Results):
14881478 XLocationUnitsObj = relationship (Units , primaryjoin = 'MeasurementResults.XLocationUnitsID == Units.UnitsID' )
14891479 YLocationUnitsObj = relationship (Units , primaryjoin = 'MeasurementResults.YLocationUnitsID == Units.UnitsID' )
14901480 ZLocationUnitsObj = relationship (Units , primaryjoin = 'MeasurementResults.ZLocationUnitsID == Units.UnitsID' )
1491- # ResultObj = relationship(Results, primaryjoin='MeasurementResults.ResultID == Results.ResultID')
1481+
14921482 __mapper_args__ = {'polymorphic_identity' :'Measurement' }
14931483
14941484
@@ -1517,7 +1507,6 @@ class MeasurementResultValues(Base):
15171507
15181508class PointCoverageResultValues (Base ):
15191509
1520-
15211510 ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
15221511 ResultID = Column ('resultid' , ForeignKey (PointCoverageResults .ResultID ), nullable = False )
15231512 DataValue = Column ('datavalue' , BigInteger , nullable = False )
@@ -1634,7 +1623,6 @@ def list_repr(self):
16341623
16351624class TrajectoryResultValues (Base ):
16361625
1637-
16381626 ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
16391627 ResultID = Column ('resultid' , ForeignKey (TrajectoryResults .ResultID ), nullable = False )
16401628 DataValue = Column ('datavalue' , Float (53 ), nullable = False )
@@ -1665,7 +1653,6 @@ class TrajectoryResultValues(Base):
16651653
16661654class TransectResultValues (Base ):
16671655
1668-
16691656 ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
16701657 ResultID = Column ('resultid' , ForeignKey (TransectResults .ResultID ), nullable = False )
16711658 DataValue = Column ('datavalue' , Float (53 ), nullable = False )
@@ -1695,7 +1682,6 @@ class TransectResultValues(Base):
16951682
16961683class CategoricalResultValueAnnotations (Base ):
16971684
1698-
16991685 BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
17001686 ValueID = Column ('valueid' , BigInteger , ForeignKey (CategoricalResultValues .ValueID ), nullable = False )
17011687 AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1706,7 +1692,6 @@ class CategoricalResultValueAnnotations(Base):
17061692
17071693class MeasurementResultValueAnnotations (Base ):
17081694
1709-
17101695 BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
17111696 ValueID = Column ('valueid' , BigInteger , ForeignKey (MeasurementResultValues .ValueID ), nullable = False )
17121697 AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1717,7 +1702,6 @@ class MeasurementResultValueAnnotations(Base):
17171702
17181703class PointCoverageResultValueAnnotations (Base ):
17191704
1720-
17211705 BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
17221706 ValueID = Column ('valueid' , BigInteger , ForeignKey (PointCoverageResultValues .ValueID ), nullable = False )
17231707 AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1738,7 +1722,6 @@ class ProfileResultValueAnnotations(Base):
17381722
17391723class SectionResultValueAnnotations (Base ):
17401724
1741-
17421725 BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
17431726 ValueID = Column ('valueid' , BigInteger , ForeignKey (SectionResultValues .ValueID ), nullable = False )
17441727 AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1749,7 +1732,6 @@ class SectionResultValueAnnotations(Base):
17491732
17501733class SpectraResultValueAnnotations (Base ):
17511734
1752-
17531735 BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
17541736 ValueID = Column ('valueid' , BigInteger , ForeignKey (SpectraResultValues .ValueID ), nullable = False )
17551737 AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1760,7 +1742,6 @@ class SpectraResultValueAnnotations(Base):
17601742
17611743class TimeSeriesResultValueAnnotations (Base ):
17621744
1763-
17641745 BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
17651746 ValueID = Column ('valueid' , BigInteger , ForeignKey (TimeSeriesResultValues .ValueID ), nullable = False )
17661747 AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1792,28 +1773,19 @@ class TransectResultValueAnnotations(Base):
17921773def _changeSchema (schema ):
17931774 import inspect
17941775 import sys
1795- #get a list of all of the classes in the module
1776+ # get a list of all of the classes in the module
17961777 clsmembers = inspect .getmembers (sys .modules [__name__ ],
17971778 lambda member : inspect .isclass (member ) and member .__module__ == __name__ )
17981779
17991780 for name , Tbl in clsmembers :
18001781 import sqlalchemy .ext .declarative .api as api
18011782
18021783 if isinstance (Tbl , api .DeclarativeMeta ):
1803- #check to see if the schema is already set correctly
1804- if Tbl .__table__ .schema == schema :
1784+ # check to see if the schema is already set correctly
1785+ if Tbl .__table__ .schema == schema :
18051786 return
18061787 Tbl .__table__ .schema = schema
1807- Tbl .__table_args__ ["schema" ]= schema
1808-
1809-
1810- # def _changeSchema(schema):
1811- # # check to see if the schema is already set correctly
1812- # # if Base.__table__.schema == schema:
1813- # # return
1814- # # Base.__table__.schema = schema
1815- # Base.__table_args__["schema"] = schema
1816- # print schema
1788+ Tbl .__table_args__ ["schema" ]= schema
18171789
18181790
18191791def _getSchema (engine ):
@@ -1830,8 +1802,6 @@ def _getSchema(engine):
18301802def setSchema (engine ):
18311803
18321804 s = _getSchema (engine )
1833- # if s is None:
1834- # s = ''
18351805 _changeSchema (s )
18361806
18371807
0 commit comments