Skip to content

Fixqueries #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jun 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .cache/v/cache/lastfailed
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"tests/test_SessionFactory.py::test_aSessionFactory[setup4]": true,
"tests/test_SessionFactory.py::test_aSessionFactory[setup5]": true,
"tests/test_SessionFactory.py::test_aSessionFactory[setup6]": true,
"tests/test_connection.py::test_connection[setup2]": true,
"tests/test_connection.py::test_connection[setup3]": true,
"tests/test_odm2/test_createservice.py::TestCreateService::()::test_createTimeSeriesResult": true,
"tests/test_odm2/test_model.py::test_cvelevationdatum[setup2]": true,
"tests/test_odm2/test_model.py::test_cvelevationdatum[setup3]": true,
"tests/test_odm2/test_model.py::test_cvsamplingfeatuergeotype[setup2]": true,
"tests/test_odm2/test_model.py::test_cvsamplingfeatuergeotype[setup3]": true,
"tests/test_odm2/test_model.py::test_cvsamplingfeaturetype[setup2]": true,
"tests/test_odm2/test_model.py::test_cvsamplingfeaturetype[setup3]": true,
"tests/test_odm2/test_model.py::test_sampling_feature[setup2]": true,
"tests/test_odm2/test_model.py::test_sampling_feature[setup3]": true
}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.py[cod]
*~
.ipynb_checkpoints


# C extensions
*.so
Expand Down Expand Up @@ -40,7 +40,9 @@ nosetests.xml

log
*.log
.idea


.DS_Store
.ipynb_checkpoints
.cache
.idea
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: python
git blanguage: python
sudo: required
# if the https://travis-ci.org/ODM2/ODM2PythonAPI/requests ever says: missing config
# validate at: http://lint.travis-ci.org/
Expand Down Expand Up @@ -38,17 +38,19 @@ addons:
- libspatialite-dev
# mariadb: '10.1'
before_script:
- ./scripts/mysql_setup.sh
- ./scripts/postgres_setup.sh
- ./scripts/freetds.sh
- ./ci-helpers/mysql_setup.sh
- ./ci-helpers/postgres_setup.sh
- ./ci-helpers/travis/freetds.sh


before_install:
# python -m pip makes the install go into the virtualenv
- python -m pip install pandas
- sudo pip install --upgrade pip
- sudo python -m pip install pandas
- export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1;python -m pip install pymssql
# - python -m pip install mysql-python
install: # now just our code
- pip install git+https://github.com/ODM2/geoalchemy.git@odm2#egg=geoalchemy-0.7.3
- pip install -e git+https://github.com/ODM2/geoalchemy.git@v0.7.4#egg=geoalchemy-0.7.4
- pip install .
- pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc
# pysqlite
Expand Down
21 changes: 11 additions & 10 deletions Examples/Sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@



import matplotlib.pyplot as plt
from matplotlib import dates
# import matplotlib.pyplot as plt




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




Expand Down Expand Up @@ -60,7 +61,7 @@
siteFeatures = read.getSamplingFeatures()
# siteFeatures = read.getSamplingFeatures(type='Site')
numSites = len(siteFeatures)

print ("Successful query")
for x in siteFeatures:
print(x.SamplingFeatureCode + ": " + x.SamplingFeatureTypeCV )
except Exception as e:
Expand All @@ -69,7 +70,7 @@

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

create.createSamplingFeature(newsf)
c=create.createSamplingFeature(newsf)
#session.commit()
print("new sampling feature added to database", newsf)
print("new sampling feature added to database", c)

except Exception as e :
print("error adding a sampling feature: " + str(e))
Expand Down
3 changes: 3 additions & 0 deletions Forms/clsDBConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def __init__( self, parent ):
self.btnTest.Bind( wx.EVT_BUTTON, self.OnBtnTest )
self.btnSave.Bind( wx.EVT_BUTTON, self.OnBtnSave )
self.btnCancel.Bind( wx.EVT_BUTTON, self.OnBtnCancel )

self.btnTest.SetFocus()


def __del__( self ):
pass
Expand Down
1 change: 1 addition & 0 deletions Forms/frmDBConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def validateInput(self, conn_dict):
if self.service_manager.test_connection(conn_dict):
message = "This connection is valid"
wx.MessageBox(message, 'Test Connection', wx.OK)
self.btn
else:
#TODO add error message if user cannont connect to the database ( not using VPN) but the db is still 1.1.1)
if not (self.service_manager.get_db_version(conn_dict)):
Expand Down
Loading