ODM2 / ODMToolsPython

ODMTools is a python application for managing observational data using the Observations Data Model. ODMTools allows you to query, visualize, and edit data stored in an Observations Data Model (ODM) database.ODMTools was originally developed as part of the CUAHSI Hydrologic Information System.
BSD 3-Clause "New" or "Revised" License
31 stars 14 forks source link

MySQL/linux case sensitive compatibility #260

Open fl0f opened 8 years ago

fl0f commented 8 years ago

Hi all,

I use "LittleBear_ODM_1.1.1_MySQL.sql" example database with linux 64bit based platform. After executing this sql code, database was created and I could explore it (through phphmyadmin). Launching ODMTools, I give database coordinates and application tries to connect, unsuccessfully. Issue was about table names which were all lower case whereas ODMTools expected upper case like "DataValues" instead of "datavalues". So I changed all table names (except for "seriescatalog" which was still expected lower case).

Then ODMTools opened successfully and I could explore all the data series. I then tried to make some edits (see also "Lasso widget disabled " issue).

After saving edits, ODM could retrieve new variable (with Quality control level set to 1) in table "seriescatalog" but no data were shown on graph. In fact, these data had been written in a new table called "datavalues". This table has been created by ODMTools at the time I saved my edits.

I could fix this issue by changing line 525 in file in odmtools/odmservices/series_service.py to :

values.to_sql(name="DataValues", if_exists='append', con=self._session_factory.engine, index=False)  ## FAP 160127

instead of :

values.to_sql(name="datavalues", if_exists='append', con=self._session_factory.engine, index=False)

Please find attached the file I modified in Pull request "MySQL/linux case sensitive compatibility" Best regards, Florent

cdesyoun commented 8 years ago

@fl0f I got this issue before, loading LBR data into MySQL DB. I did disable MySQL case sensitive with table names in ubuntu linux as follows:

$ sudo emacs /etc/mysql/my.cnf
in this file, add this line "lower_case_table_names=1",

[mysqld]
#
# * Basic Settings
#
lower_case_table_names = 1
user            = mysql

and then restart mysql server, 
$ sudo service mysql restart
fl0f commented 8 years ago

Ok, thanks for the trick. However, there is not a long way to get your soft fully case sensitive compatible

valentinedwv commented 8 years ago

sudo sed -i '/[mysqld]/a lower_case_table_names = 1 ' /etc/mysql/my.cnf

This is the way to make MySQL behave in an SQL compliant manner across all the Operating Systems that MySQL supports.

AmberSJones commented 8 years ago

reference issue #161