Skip to content
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

Problems with queries on SQLite with polymorphic classes or explicit joins #75

Closed
emiliom opened this issue Apr 3, 2017 · 3 comments
Closed

Comments

@emiliom
Copy link
Member

emiliom commented Apr 3, 2017

@sreeder, @horsburgh, @Castronova:

I hadn't worked with SQLite ODM2 databases and odm2api in a long time, until recently (last month). @lsetiawan and I tried WOFpy with the LBR SQLite sample database, and ran into errors that impact queries with explicit joins, or polymorphic objects such as Sites and TimeSeriesResults that inherit from base classes (for those two examples, that would be SamplingFeatures and Results) and therefore involve what I'll call a "behind the scenes" join to the base class/table.

We've partly documented this problem here. We've also ran a number of tests using odm2api alone (no WOFpy) to confirm that the source of the problem we see on WOFpy is actually from odm2api. Also ran some limited tests using SQLAlchemy queries (with the session query method) that involve joins.

Using the polymorphic classes or joins is giving us errors, and the error traceback appear to involve the join attempt (explicit or "behind the scenes" joins); auto-renamed foreign keys (eg, odm2_samplingfeatures_samplingfeatureid) are implicated in the error reports.

SO: Are you using odm2api regularly with SQLite databases, say, for HydroShare?

FYI, the odm2api "read" services (eg, getSamplingFeatures) work fine, in our limited tests. But when we apply a session query on one of the polymorphic classes like Sites, that's when we get failures with SQLite databases that we don't get with the LBR MySQL test database.

Thanks. FYI, having WOFpy work with SQLite ODM2 databases will make it easier to do WOFpy testing, and specially auto-testing via Continuous Integration.

@emiliom
Copy link
Member Author

emiliom commented Apr 13, 2017

We talked about this briefly at the last BiGCZ call last week. It's not a high priority right now, but it'd very nice to start accumulating examples that do work. @horsburgh mentioned that @Castronova may have some Jupyter notebooks, even if HydroShare proper doesn't use odm2api to interact with its ODM2 SQLite timeseries resources.

Anything any of you (@sreeder, @horsburgh, @Castronova) could share would be great. A link to code somewhere else (a github repo, a HydroShare resource, etc) is just fine. Thanks!

@horsburgh
Copy link
Member

Following up with @Castronova to see if the HydroShare examples still work so we can post links.

@emiliom emiliom added this to the v0.7.2 release milestone Apr 8, 2019
@emiliom
Copy link
Member Author

emiliom commented Apr 21, 2019

I've looked into the status of this issue. I think it's already been addressed. That's based on the related follow-ups at ODM2/WOFpy#75, as well as our extensive experience over the last ~ 18 months successfully running queries involving polymorphic objects, specially Sites.

So, I'm closing it.

@emiliom emiliom closed this as completed Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants