Skip to content
Closed
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
19 changes: 8 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ addons:
- wx2.8-i18n


# mariadb: '10.1'
before_script:
- ./ci-helpers/travis/mysql_setup.sh
- ./ci-helpers/travis/postgres_setup.sh
- ./ci-helpers/travis/freetds.sh



before_install:
Expand All @@ -65,12 +61,13 @@ install: # now just our code

# mariadb: '10.1'
before_script:
- chmod +x ./tests/scripts/mysql_setup.sh
# - chmod +x ./tests/scripts/postgres_setup.sh
- chmod +x ./tests/scripts/freetds.sh
- ./tests/scripts/mysql_setup.sh
# - ./tests/scripts/postgres_setup.sh
- ./tests/scripts/freetds.sh
- chmod +x ./ci-helpers/travis/mysql_setup.sh
# - chmod +x ./ci-helpers/travis/postgres_setup.sh
- chmod +x ./ci-helpers/travis/freetds.sh

- ./ci-helpers/travis/mysql_setup.sh
# - ./ci-helpers/travis/postgres_setup.sh
- ./ci-helpers/travis/freetds.sh

# command to run tests
script:
Expand Down
14 changes: 7 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ install:
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
# add databases
- "SET PATH=%POSTGRES_PATH%\bin;%MYSQL_PATH%\bin;%PATH%"
- "SET PATH=%POSTGRES_PATH%\\bin;%MYSQL_PATH%\\bin;%PATH%"
- "activate test"

# Check that we have the expected version and architecture for Python
Expand All @@ -110,12 +110,12 @@ build_script:
- sqlcmd -S localhost,1433 -U sa -P Password12! -Q "CREATE DATABASE odm" -d "master"
- sqlcmd -S localhost,1433 -U sa -P Password12! -i tests\data\sampledb\odm_mssql.sql -d "odm"
- sqlcmd -S localhost,1433 -U sa -P Password12! -Q "select table_name from information_schema.tables" -d "odm"
# # postgres
# - psql createdb odm
# - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql
# # mysql
# - mysql -e "drop database test; create database odm;" --user=root
# - mysql odm < tests\data\sampledb\odm_mysql.sql --user=root
# postgres
- psql createdb odm
- psql -d odm -a -f tests\data\sampledb\odm_postgres.sql
# mysql
- mysql -e "drop database test; create database odm;" --user=root
- mysql odm < tests\data\sampledb\odm_mysql.sql --user=root

test_script:
# Run the project tests
Expand Down
4 changes: 2 additions & 2 deletions ci-helpers/travis/mysql_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ mysql -e "create database IF NOT EXISTS odm2test;" --user=root
#####
# install
#####
ls -al ./tests/scripts/sampledb/odm_mysql.sql ./tests/scripts/sampledb/odm_postgres.sql
mysql --user=ODM --password=odm odm < ./tests/scripts/sampledb/odm_mysql.sql
ls -al ./tests/data/sampledb/odm_mysql.sql ./tests/data/sampledb/odm_postgres.sql
mysql --user=ODM --password=odm odm < ./tests/data/sampledb/odm_mysql.sql
mysql --user=root -e "show databases;"
mysql --user=root -e "GRANT ALL PRIVILEGES ON odm.* TO 'ODM'@'localhost';FLUSH PRIVILEGES;"
# these should produce results, if they don't the lower_case_table_names failed
Expand Down
4 changes: 2 additions & 2 deletions ci-helpers/travis/postgres_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
psql -U postgres -c "create extension postgis"
psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres;
psql -c 'create database odmtest;' -U postgres;
#psql -U postgres -d odmtest -a -f ./tests/scripts/sampledb/odm_postgres.sql
#psql -U postgres -d odmtest -a -f ./tests/data/sampledb/odm_postgres.sql
psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres;
psql -c 'create database odm;' -U postgres;
## install
# add -a to psql to see full log, -q is quiet
psql -U postgres -q -f ./tests/scripts/sampledb/odm_postgres.sql
psql -U postgres -q -f ./tests/data/sampledb/odm_postgres.sql
13 changes: 12 additions & 1 deletion odmtools/gui/frmODMTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from odmtools.controller.frmDataTable import FrmDataTable
import mnuRibbon
import pnlPlot
import pnlPlot
import pnlDataTable
import wx.lib.agw.aui as aui
import wx.py.crust
Expand Down Expand Up @@ -55,6 +56,7 @@ def __init__(self, **kwargs):

self.service_manager = ServiceManager()
self.record_service = None
self.scriptcreate = False

series_service = self._init_database()
if series_service:
Expand Down Expand Up @@ -384,7 +386,7 @@ def onSetScriptTitle(self, title):
def addEdit(self, event):

with wx.BusyInfo("Please wait for a moment while ODMTools fetches the data and stores it in our database", parent=self):

self.scriptcreate = True
isSelected, seriesID = self.pnlSelector.onReadyToEdit()
logger.info("Beginning editing seriesID: %s"%str(seriesID))

Expand Down Expand Up @@ -496,6 +498,15 @@ def onClose(self, event):
Closes ODMTools Python
Closes AUI Manager then closes MainWindow
"""

#check to see if a script has been created
if self.scriptcreate:
msg = wx.MessageDialog(None, 'Would you like to save your editing script?',
'Save Script', wx.YES_NO | wx.ICON_QUESTION)
value = msg.ShowModal()
if value == wx.ID_YES:
self.txtPythonScript.OnSaveAs(event)

# deinitialize the frame manager
self.pnlPlot.Close()
try:
Expand Down
16 changes: 10 additions & 6 deletions odmtools/odmdata/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Series(Base):
variable_id = Column('VariableID', Integer, ForeignKey('Variables.VariableID'), nullable=False)
variable_code = Column('VariableCode', String)
variable_name = Column('VariableName', String)

speciation = Column('Speciation', String)
variable_units_id = Column('VariableUnitsID', Integer)
variable_units_name = Column('VariableUnitsName', String)
Expand Down Expand Up @@ -118,26 +119,29 @@ def get_table_columns(self):
return self.__table__.columns.keys()

def list_repr(self):
return [self.id, self.site_id, self.site_code, self.site_name, self.variable_id, self.variable_code,
return [self.id, self.site_code, self.variable_code, self.quality_control_level_code,
self.site_id, self.site_name, self.variable_id,
self.variable_name, self.speciation, self.variable_units_id, self.variable_units_name,
self.sample_medium, self.value_type, self.time_support, self.time_units_id, self.time_units_name,
self.data_type, self.general_category, self.method_id, self.method_description,
self.source_id, self.source_description, self.organization, self.citation,
self.quality_control_level_id, self.quality_control_level_code, self.begin_date_time,
self.quality_control_level_id, self.begin_date_time,
self.end_date_time, self.begin_date_time_utc, self.end_date_time_utc, self.value_count]

def returnDict():
keys = ['SeriesID', 'SiteID', 'SiteCode', 'SiteName', 'VariableID', 'VariableCode', 'VariableName', 'Speciation',
keys = ['SeriesID', 'SiteCode','VariableCode','QualityControlLevelCode',
'SiteID', 'SiteName', 'VariableID', 'VariableName', 'Speciation',
'VariableUnitsID', 'VariableUnitsName', 'SampleMedium', 'ValueType', 'TimeSupport', 'TimeUnitsID',
'TimeUnitsName', 'DataType', 'GeneralCategory', 'MethodID', 'MethodDescription', 'SourceID',
'SourceDescription', 'Organization', 'Citation', 'QualityControlLevelID', 'QualityControlLevelCode',
'SourceDescription', 'Organization', 'Citation', 'QualityControlLevelID',
'BeginDateTime', 'EndDateTime', 'BeginDateTimeUTC', 'EndDateTimeUTC', 'ValueCount'
]
values = ['id', 'site_id', 'site_code', 'site_name', 'variable_id', 'variable_code', 'variable_name', 'speciation',
values = ['id', 'site_code','variable_code','quality_control_level_code',
'site_id', 'site_name', 'variable_id', 'variable_name', 'speciation',
'variable_units_id', 'variable_units_name', 'sample_medium', 'value_type', 'time_support',
'time_units_id', 'time_units_name', 'data_type', 'general_category', 'method_id', 'method_description',
'source_id', 'source_description', 'organization', 'citation', 'quality_control_level_id',
'quality_control_level_code', 'begin_date_time', 'end_date_time', 'begin_date_time_utc',
'begin_date_time', 'end_date_time', 'begin_date_time_utc',
'end_date_time_utc', 'value_count'
]
return OrderedDict(zip(keys, values))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pyodbc
pymysql
numpy
#scipy
sqlalchemy
#matplotlib
#scipy
#psycopg2
#pandas
#geoalchemy2
Expand Down
1 change: 0 additions & 1 deletion toolsenvironment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ dependencies:
- pyodbc==3.0.7
- python-dateutil==2.4.1
- wxpython-common==3.0.0.0