Description
In #24 we went back forth with some changes to ODM2/models.py and possibly ODM2/services/readService.py regarding SamplingFeatures and the use of geoalchemy 1. A couple of merges were involved. These changes sort-of continued in #27, and have some linkage earlier to #13.
Before that, we got Examples/Sample.py to work top to bottom with its SQLite sample database (FYI, I never tested the SamplingFeature creation code). Here's a working IPython notebook version I made on 1/21
Now, I'm unable to access ReadODM2.getSamplingFeature
methods to work anymore. They work on PostgreSQL, but not SQLite. With @horsburgh's ODM2 Little Bear River sqlite sample file, a method request such as getSamplingFeaturesByType('Site')
leads to this error:
(sqlite3.OperationalError) no such function: AsBinary [SQL: u'SELECT
samplingfeatures.samplingfeatureid AS odm2_samplingfeatures_samplingfeatureid,
samplingfeatures.samplingfeatureuuid AS odm2_samplingfeatures_samplingfeatureuuid,
samplingfeatures.samplingfeaturetypecv AS odm2_samplingfeatures_samplingfeaturetypecv,
samplingfeatures.samplingfeaturecode AS odm2_samplingfeatures_samplingfeaturecode,
samplingfeatures.samplingfeaturename AS odm2_samplingfeatures_samplingfeaturename, samplingfeatures.samplingfeaturedescription AS odm2_samplingfeatures_samplingfeaturedescription,
samplingfeatures.samplingfeaturegeotypecv AS odm2_samplingfeatures_samplingfeaturegeotypecv,
samplingfeatures.elevation_m AS odm2_samplingfeatures_elevation_m,
samplingfeatures.elevationdatumcv AS odm2_samplingfeatures_elevationdatumcv,
AsBinary(samplingfeatures.featuregeometry) AS odm2_samplingfeatures_featuregeometry
\nFROM samplingfeatures
\nWHERE samplingfeatures.samplingfeaturetypecv = ?'] [parameters: ('site',)]
Note the problem with the AsBinary
SQL function. Probing a bit further, I see the error comes from sqlalchemy/engine/default.py
, specifically line 450 below:
449 def do_execute(self, cursor, statement, parameters, context=None):
450 cursor.execute(statement, parameters)
I've gone through the relevant commit history for ODM2/models.py and ODM2/services/readService.py since early December, and can't find anything that's different from a time in mid January when things were working fine. I'm stumped.
@denvaar has moved to greener pastures and @sreeder is still away on maternity leave. So, for now I'm creating this issue as documentation of the problem. I'll keep tackling it, and will add more information in a bit.