Skip to content

Commit c7e2a0c

Browse files
author
Stephanie Reeder
authored
Merge pull request #68 from ODM2/fixqueries
Fixqueries
2 parents 6ad5117 + fabd2d7 commit c7e2a0c

25 files changed

+749
-2390
lines changed

.cache/v/cache/lastfailed

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"tests/test_SessionFactory.py::test_aSessionFactory[setup4]": true,
3+
"tests/test_SessionFactory.py::test_aSessionFactory[setup5]": true,
4+
"tests/test_SessionFactory.py::test_aSessionFactory[setup6]": true,
5+
"tests/test_connection.py::test_connection[setup2]": true,
6+
"tests/test_connection.py::test_connection[setup3]": true,
7+
"tests/test_odm2/test_createservice.py::TestCreateService::()::test_createTimeSeriesResult": true,
8+
"tests/test_odm2/test_model.py::test_cvelevationdatum[setup2]": true,
9+
"tests/test_odm2/test_model.py::test_cvelevationdatum[setup3]": true,
10+
"tests/test_odm2/test_model.py::test_cvsamplingfeatuergeotype[setup2]": true,
11+
"tests/test_odm2/test_model.py::test_cvsamplingfeatuergeotype[setup3]": true,
12+
"tests/test_odm2/test_model.py::test_cvsamplingfeaturetype[setup2]": true,
13+
"tests/test_odm2/test_model.py::test_cvsamplingfeaturetype[setup3]": true,
14+
"tests/test_odm2/test_model.py::test_sampling_feature[setup2]": true,
15+
"tests/test_odm2/test_model.py::test_sampling_feature[setup3]": true
16+
}

.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*.py[cod]
22
*~
3-
.ipynb_checkpoints
3+
44

55
# C extensions
66
*.so
@@ -40,7 +40,9 @@ nosetests.xml
4040

4141
log
4242
*.log
43-
.idea
43+
4444

4545
.DS_Store
4646
.ipynb_checkpoints
47+
.cache
48+
.idea

.travis.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
language: python
1+
git blanguage: python
22
sudo: required
33
# if the https://travis-ci.org/ODM2/ODM2PythonAPI/requests ever says: missing config
44
# validate at: http://lint.travis-ci.org/
@@ -38,17 +38,19 @@ addons:
3838
- libspatialite-dev
3939
# mariadb: '10.1'
4040
before_script:
41-
- ./scripts/mysql_setup.sh
42-
- ./scripts/postgres_setup.sh
43-
- ./scripts/freetds.sh
41+
- ./ci-helpers/mysql_setup.sh
42+
- ./ci-helpers/postgres_setup.sh
43+
- ./ci-helpers/travis/freetds.sh
44+
4445

4546
before_install:
4647
# python -m pip makes the install go into the virtualenv
47-
- python -m pip install pandas
48+
- sudo pip install --upgrade pip
49+
- sudo python -m pip install pandas
4850
- export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1;python -m pip install pymssql
4951
# - python -m pip install mysql-python
5052
install: # now just our code
51-
- pip install git+https://github.com/ODM2/geoalchemy.git@odm2#egg=geoalchemy-0.7.3
53+
- pip install -e git+https://github.com/ODM2/geoalchemy.git@v0.7.4#egg=geoalchemy-0.7.4
5254
- pip install .
5355
- pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc
5456
# pysqlite

Examples/Sample.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44

5-
import matplotlib.pyplot as plt
6-
from matplotlib import dates
5+
# import matplotlib.pyplot as plt
6+
77

88

99

@@ -17,10 +17,11 @@
1717
#connect to database
1818
# createconnection (dbtype, servername, dbname, username, password)
1919
# session_factory = dbconnection.createConnection('connection type: sqlite|mysql|mssql|postgresql', '/your/path/to/db/goes/here', 2.0)#sqlite
20-
# session_factory = dbconnection.createConnection('mysql', 'localhost', 'odm2', 'ODM', 'odm')#mysql
20+
session_factory = dbconnection.createConnection('mysql', 'localhost', 'odm2', 'ODM', 'odm')#mysql
2121
# session_factory= dbconnection.createConnection('mssql', "(local)", "LBRODM2", "ODM", "odm")#win MSSQL
22-
session_factory= dbconnection.createConnection('mssql', "arroyoodm2", "", "ODM", "odm")#mac/linux MSSQL
23-
# session_factory = dbconnection.createConnection('sqlite', '/Users/Stephanie/Desktop/TestODM2.db', 2.0)
22+
# session_factory= dbconnection.createConnection('mssql', "arroyoodm2", "", "ODM", "odm")#mac/linux MSSQL
23+
# session_factory = dbconnection.createConnection('sqlite', '/Users/stephanie/DEV/ODM2/usecases/WOF_to_ODM2/ODM2.sqlite', 2.0)
24+
2425

2526

2627

@@ -60,7 +61,7 @@
6061
siteFeatures = read.getSamplingFeatures()
6162
# siteFeatures = read.getSamplingFeatures(type='Site')
6263
numSites = len(siteFeatures)
63-
64+
print ("Successful query")
6465
for x in siteFeatures:
6566
print(x.SamplingFeatureCode + ": " + x.SamplingFeatureTypeCV )
6667
except Exception as e:
@@ -69,7 +70,7 @@
6970

7071
# Now get the SamplingFeature object for a SamplingFeature code
7172
try:
72-
sf = read.getSamplingFeatures(code=['USU-LBR-Mendon'])[0]
73+
sf = read.getSamplingFeatures(codes=['USU-LBR-Mendon'])[0]
7374
print(sf)
7475
print("\n-------- Information about an individual SamplingFeature ---------")
7576
print("The following are some of the attributes of a SamplingFeature retrieved using getSamplingFeatureByCode(): \n")
@@ -88,13 +89,13 @@
8889
# from odm2api.ODM2.models import SamplingFeatures
8990
session = session_factory.getSession()
9091
newsf = Sites(FeatureGeometryWKT = "POINT(-111.946 41.718)", Elevation_m=100, ElevationDatumCV=sf.ElevationDatumCV,
91-
SamplingFeatureCode= "TestSF",SamplingFeatureDescription = "this is a test to add Feature Geomotry",
92+
SamplingFeatureCode= "TestSF",SamplingFeatureDescription = "this is a test in sample.py",
9293
SamplingFeatureGeotypeCV= "Point", SamplingFeatureTypeCV=sf.SamplingFeatureTypeCV,SamplingFeatureUUID= sf.SamplingFeatureUUID+"2",
9394
SiteTypeCV="cave", Latitude= "100", Longitude= "-100", SpatialReferenceID= 0)
9495

95-
create.createSamplingFeature(newsf)
96+
c=create.createSamplingFeature(newsf)
9697
#session.commit()
97-
print("new sampling feature added to database", newsf)
98+
print("new sampling feature added to database", c)
9899

99100
except Exception as e :
100101
print("error adding a sampling feature: " + str(e))

Forms/clsDBConfig.py

+3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def __init__( self, parent ):
115115
self.btnTest.Bind( wx.EVT_BUTTON, self.OnBtnTest )
116116
self.btnSave.Bind( wx.EVT_BUTTON, self.OnBtnSave )
117117
self.btnCancel.Bind( wx.EVT_BUTTON, self.OnBtnCancel )
118+
119+
self.btnTest.SetFocus()
120+
118121

119122
def __del__( self ):
120123
pass

Forms/frmDBConfig.py

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def validateInput(self, conn_dict):
7878
if self.service_manager.test_connection(conn_dict):
7979
message = "This connection is valid"
8080
wx.MessageBox(message, 'Test Connection', wx.OK)
81+
self.btn
8182
else:
8283
#TODO add error message if user cannont connect to the database ( not using VPN) but the db is still 1.1.1)
8384
if not (self.service_manager.get_db_version(conn_dict)):

0 commit comments

Comments
 (0)