13
13
BigIntegerType = BigIntegerType .with_variant (mysql .BIGINT (), 'mysql' )
14
14
15
15
16
-
17
-
18
-
19
16
def is_hex (s ):
20
17
try :
21
18
int (s , base = 16 )
@@ -1212,6 +1209,7 @@ class MethodCitations(Base):
1212
1209
RelationshipTypeCV = Column ('relationshiptypecv' , ForeignKey (CVRelationshipType .Name ), nullable = False ,
1213
1210
index = True )
1214
1211
CitationID = Column ('citationid' , ForeignKey (Citations .CitationID ), nullable = False )
1212
+
1215
1213
CitationObj = relationship (Citations )
1216
1214
MethodObj = relationship (Methods )
1217
1215
@@ -1278,7 +1276,6 @@ class RelatedResults(Base):
1278
1276
# ################################################################################
1279
1277
class PointCoverageResults (Results ):
1280
1278
1281
-
1282
1279
ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
1283
1280
ZLocation = Column ('zlocation' , Float (53 ))
1284
1281
ZLocationUnitsID = Column ('zlocationunitsid' , ForeignKey (Units .UnitsID ))
@@ -1296,12 +1293,11 @@ class PointCoverageResults(Results):
1296
1293
IntendedYSpacingUnitsObj = relationship (Units , primaryjoin = 'PointCoverageResults.IntendedYSpacingUnitsID == Units.UnitsID' )
1297
1294
SpatialReferenceObj = relationship (SpatialReferences )
1298
1295
ZLocationUnitsObj = relationship (Units , primaryjoin = 'PointCoverageResults.ZLocationUnitsID == Units.UnitsID' )
1299
- # ResultObj = relationship(Results, primaryjoin='PointCoverageResults.ResultID == Results.ResultID')
1300
- __mapper_args__ = {'polymorphic_identity' :'Point coverage' }
1301
1296
1297
+ __mapper_args__ = {'polymorphic_identity' : 'Point coverage' }
1302
1298
1303
- class ProfileResults (Results ):
1304
1299
1300
+ class ProfileResults (Results ):
1305
1301
1306
1302
ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
1307
1303
XLocation = Column ('xlocation' , Float (53 ))
@@ -1321,12 +1317,11 @@ class ProfileResults(Results):
1321
1317
SpatialReferenceObj = relationship (SpatialReferences )
1322
1318
XLocationUnitsObj = relationship (Units , primaryjoin = 'ProfileResults.XLocationUnitsID == Units.UnitsID' )
1323
1319
YLocationUnitsObj = relationship (Units , primaryjoin = 'ProfileResults.YLocationUnitsID == Units.UnitsID' )
1324
- # ResultObj = relationship(Results, primaryjoin='ProfileResults.ResultID == Results.ResultID')
1325
- __mapper_args__ = {'polymorphic_identity' :'Profile Coverage' }
1326
1320
1321
+ __mapper_args__ = {'polymorphic_identity' : 'Profile Coverage' }
1327
1322
1328
- class CategoricalResults (Results ):
1329
1323
1324
+ class CategoricalResults (Results ):
1330
1325
1331
1326
ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
1332
1327
XLocation = Column ('xlocation' , Float (53 ))
@@ -1343,8 +1338,7 @@ class CategoricalResults(Results):
1343
1338
YLocationUnitsObj = relationship (Units , primaryjoin = 'CategoricalResults.YLocationUnitsID == Units.UnitsID' )
1344
1339
ZLocationUnitsObj = relationship (Units , primaryjoin = 'CategoricalResults.ZLocationUnitsID == Units.UnitsID' )
1345
1340
1346
- # ResultObj = relationship(Results, primaryjoin='CategoricalResults.ResultID == Results.ResultID')
1347
- __mapper_args__ = {'polymorphic_identity' :'Category coverage' }
1341
+ __mapper_args__ = {'polymorphic_identity' :' Category coverage' }
1348
1342
1349
1343
1350
1344
class TransectResults (Results ):
@@ -1365,12 +1359,11 @@ class TransectResults(Results):
1365
1359
IntendedTransectSpacingUnitsObj = relationship (Units , primaryjoin = 'TransectResults.IntendedTransectSpacingUnitsID == Units.UnitsID' )
1366
1360
SpatialReferenceObj = relationship (SpatialReferences )
1367
1361
ZLocationUnitsObj = relationship (Units , primaryjoin = 'TransectResults.ZLocationUnitsID == Units.UnitsID' )
1368
- # ResultObj = relationship(Results, primaryjoin='TransectResults.ResultID == Results.ResultID')
1369
- __mapper_args__ = {'polymorphic_identity' :'Transect Coverage' }
1370
1362
1363
+ __mapper_args__ = {'polymorphic_identity' : 'Transect Coverage' }
1371
1364
1372
- class SpectraResults (Results ):
1373
1365
1366
+ class SpectraResults (Results ):
1374
1367
1375
1368
ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
1376
1369
XLocation = Column ('xlocation' , Float (53 ))
@@ -1390,7 +1383,7 @@ class SpectraResults(Results):
1390
1383
XLocationUnitsObj = relationship (Units , primaryjoin = 'SpectraResults.XLocationUnitsID == Units.UnitsID' )
1391
1384
YLocationUnitsObj = relationship (Units , primaryjoin = 'SpectraResults.YLocationUnitsID == Units.UnitsID' )
1392
1385
ZLocationUnitsObj = relationship (Units , primaryjoin = 'SpectraResults.ZLocationUnitsID == Units.UnitsID' )
1393
- # ResultObj = relationship(Results, primaryjoin='SpectraResults.ResultID == Results.ResultID')
1386
+
1394
1387
__mapper_args__ = {'polymorphic_identity' :'Spectra coverage' }
1395
1388
1396
1389
@@ -1409,14 +1402,13 @@ class TimeSeriesResults(Results):
1409
1402
AggregationStatisticCV = Column ('aggregationstatisticcv' , ForeignKey (CVAggregationStatistic .Name ),
1410
1403
nullable = False , index = True )
1411
1404
1412
- # ResultObj = relationship(Results)
1413
1405
IntendedTimeSpacingUnitsObj = relationship (Units ,
1414
- primaryjoin = 'TimeSeriesResults.IntendedTimeSpacingUnitsID == Units.UnitsID' )
1406
+ primaryjoin = 'TimeSeriesResults.IntendedTimeSpacingUnitsID == Units.UnitsID' )
1415
1407
SpatialReferenceObj = relationship (SpatialReferences )
1416
1408
XLocationUnitsObj = relationship (Units , primaryjoin = 'TimeSeriesResults.XLocationUnitsID == Units.UnitsID' )
1417
1409
YLocationUnitsObj = relationship (Units , primaryjoin = 'TimeSeriesResults.YLocationUnitsID == Units.UnitsID' )
1418
1410
ZLocationUnitsObj = relationship (Units , primaryjoin = 'TimeSeriesResults.ZLocationUnitsID == Units.UnitsID' )
1419
- # ResultObj = relationship(Results, primaryjoin='TimeSeriesResults.ResultID == Results.ResultID')
1411
+
1420
1412
__mapper_args__ = {'polymorphic_identity' :'Time series coverage' }
1421
1413
1422
1414
@@ -1440,13 +1432,12 @@ class SectionResults(Results):
1440
1432
IntendedZSpacingUnitsObj = relationship (Units , primaryjoin = 'SectionResults.IntendedZSpacingUnitsID == Units.UnitsID' )
1441
1433
SpatialReferenceObj = relationship (SpatialReferences )
1442
1434
YLocationUnitsObj = relationship (Units , primaryjoin = 'SectionResults.YLocationUnitsID == Units.UnitsID' )
1443
- # ResultObj = relationship(Results, primaryjoin='SectionResults.ResultID == Results.ResultID')
1435
+
1444
1436
__mapper_args__ = {'polymorphic_identity' :'Section coverage' }
1445
1437
1446
1438
1447
1439
class TrajectoryResults (Results ):
1448
1440
1449
-
1450
1441
ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
1451
1442
SpatialReferenceID = Column ('spatialreferenceid' , ForeignKey (SpatialReferences .SpatialReferenceID ))
1452
1443
IntendedTrajectorySpacing = Column ('intendedtrajectoryspacing' , Float (53 ))
@@ -1460,13 +1451,12 @@ class TrajectoryResults(Results):
1460
1451
IntendedTrajectorySpacingUnitsObj = relationship (Units ,
1461
1452
primaryjoin = 'TrajectoryResults.IntendedTrajectorySpacingUnitsID == Units.UnitsID' )
1462
1453
SpatialReferenceObj = relationship (SpatialReferences )
1463
- # ResultObj = relationship(Results, primaryjoin='TrajectoryResults.ResultID == Results.ResultID')
1454
+
1464
1455
__mapper_args__ = {'polymorphic_identity' :'Trajectory coverage' }
1465
1456
1466
1457
1467
1458
class MeasurementResults (Results ):
1468
1459
1469
-
1470
1460
ResultID = Column ('resultid' , ForeignKey (Results .ResultID ), primary_key = True )
1471
1461
XLocation = Column ('xlocation' , Float (53 ))
1472
1462
XLocationUnitsID = Column ('xlocationunitsid' , ForeignKey (Units .UnitsID ))
@@ -1488,7 +1478,7 @@ class MeasurementResults(Results):
1488
1478
XLocationUnitsObj = relationship (Units , primaryjoin = 'MeasurementResults.XLocationUnitsID == Units.UnitsID' )
1489
1479
YLocationUnitsObj = relationship (Units , primaryjoin = 'MeasurementResults.YLocationUnitsID == Units.UnitsID' )
1490
1480
ZLocationUnitsObj = relationship (Units , primaryjoin = 'MeasurementResults.ZLocationUnitsID == Units.UnitsID' )
1491
- # ResultObj = relationship(Results, primaryjoin='MeasurementResults.ResultID == Results.ResultID')
1481
+
1492
1482
__mapper_args__ = {'polymorphic_identity' :'Measurement' }
1493
1483
1494
1484
@@ -1517,7 +1507,6 @@ class MeasurementResultValues(Base):
1517
1507
1518
1508
class PointCoverageResultValues (Base ):
1519
1509
1520
-
1521
1510
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1522
1511
ResultID = Column ('resultid' , ForeignKey (PointCoverageResults .ResultID ), nullable = False )
1523
1512
DataValue = Column ('datavalue' , BigInteger , nullable = False )
@@ -1634,7 +1623,6 @@ def list_repr(self):
1634
1623
1635
1624
class TrajectoryResultValues (Base ):
1636
1625
1637
-
1638
1626
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1639
1627
ResultID = Column ('resultid' , ForeignKey (TrajectoryResults .ResultID ), nullable = False )
1640
1628
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
@@ -1665,7 +1653,6 @@ class TrajectoryResultValues(Base):
1665
1653
1666
1654
class TransectResultValues (Base ):
1667
1655
1668
-
1669
1656
ValueID = Column ('valueid' , BigIntegerType , primary_key = True )
1670
1657
ResultID = Column ('resultid' , ForeignKey (TransectResults .ResultID ), nullable = False )
1671
1658
DataValue = Column ('datavalue' , Float (53 ), nullable = False )
@@ -1695,7 +1682,6 @@ class TransectResultValues(Base):
1695
1682
1696
1683
class CategoricalResultValueAnnotations (Base ):
1697
1684
1698
-
1699
1685
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1700
1686
ValueID = Column ('valueid' , BigInteger , ForeignKey (CategoricalResultValues .ValueID ), nullable = False )
1701
1687
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1706,7 +1692,6 @@ class CategoricalResultValueAnnotations(Base):
1706
1692
1707
1693
class MeasurementResultValueAnnotations (Base ):
1708
1694
1709
-
1710
1695
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1711
1696
ValueID = Column ('valueid' , BigInteger , ForeignKey (MeasurementResultValues .ValueID ), nullable = False )
1712
1697
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1717,7 +1702,6 @@ class MeasurementResultValueAnnotations(Base):
1717
1702
1718
1703
class PointCoverageResultValueAnnotations (Base ):
1719
1704
1720
-
1721
1705
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1722
1706
ValueID = Column ('valueid' , BigInteger , ForeignKey (PointCoverageResultValues .ValueID ), nullable = False )
1723
1707
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1738,7 +1722,6 @@ class ProfileResultValueAnnotations(Base):
1738
1722
1739
1723
class SectionResultValueAnnotations (Base ):
1740
1724
1741
-
1742
1725
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1743
1726
ValueID = Column ('valueid' , BigInteger , ForeignKey (SectionResultValues .ValueID ), nullable = False )
1744
1727
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1749,7 +1732,6 @@ class SectionResultValueAnnotations(Base):
1749
1732
1750
1733
class SpectraResultValueAnnotations (Base ):
1751
1734
1752
-
1753
1735
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1754
1736
ValueID = Column ('valueid' , BigInteger , ForeignKey (SpectraResultValues .ValueID ), nullable = False )
1755
1737
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1760,7 +1742,6 @@ class SpectraResultValueAnnotations(Base):
1760
1742
1761
1743
class TimeSeriesResultValueAnnotations (Base ):
1762
1744
1763
-
1764
1745
BridgeID = Column ('bridgeid' , Integer , primary_key = True , nullable = False )
1765
1746
ValueID = Column ('valueid' , BigInteger , ForeignKey (TimeSeriesResultValues .ValueID ), nullable = False )
1766
1747
AnnotationID = Column ('annotationid' , ForeignKey (Annotations .AnnotationID ), nullable = False )
@@ -1792,28 +1773,19 @@ class TransectResultValueAnnotations(Base):
1792
1773
def _changeSchema (schema ):
1793
1774
import inspect
1794
1775
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
1796
1777
clsmembers = inspect .getmembers (sys .modules [__name__ ],
1797
1778
lambda member : inspect .isclass (member ) and member .__module__ == __name__ )
1798
1779
1799
1780
for name , Tbl in clsmembers :
1800
1781
import sqlalchemy .ext .declarative .api as api
1801
1782
1802
1783
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 :
1805
1786
return
1806
1787
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
1817
1789
1818
1790
1819
1791
def _getSchema (engine ):
@@ -1830,8 +1802,6 @@ def _getSchema(engine):
1830
1802
def setSchema (engine ):
1831
1803
1832
1804
s = _getSchema (engine )
1833
- # if s is None:
1834
- # s = ''
1835
1805
_changeSchema (s )
1836
1806
1837
1807
0 commit comments