-
Notifications
You must be signed in to change notification settings - Fork 18
add ORM for Firehose objects #23
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
base: master
Are you sure you want to change the base?
add ORM for Firehose objects #23
Conversation
the ORM uses SQLAlchemy to map Firehose objects with SQL tables.
|
Hi @davidmalcolm, we discussed with @paultag about integrating the orm used in firewoes directly into firehose. |
|
Thanks for this, @matthieucan ! |
|
Thanks. Is there any automated test coverage for this? i.e. can we have, say, a tests/test_orm.py that exercises things against an in-memory sqlite db? (does this already exist within the firewoes code?) |
|
Yes, we have this in firewoes. But I need a data set, do you think the xml files in examples/ are enough or should I add those we use? |
|
Looking at firewoes, presumably you mean the xml files in: That said, the firewoes examples look like real examples, and there's merit to that, and any testing is better than no testing :) Also, is the firewoes test suite: https://github.com/Debian/firewoes/blob/master/tests/tests.py ? Perhaps we could also have tests that simply create some objects in a loop, using logic to establish properties e.g. 10 issues, of which 3 are in one file, 7 in another, and then run a query and assert that we get the right thing back? |
|
Yes I meant these xml files in firewoes/test/data, which were more intended for firewoes anyway, those in examples/ make indeed more sense. |
Adds an autoincrement integer for the primary keys, and a field 'hash' that replaces the former primary key (strings). This permits to stay generic and still use the field "hash" in firewoes.
This script adds the analysises in examples/ to an in-memory db, queries it, and ensures the returned values are correct.
|
Should I add 'sqlalchemy' in requirements.txt and make travis.yml install them? |
|
Yes please. |
|
Since I use single table inheritance for firehose.model.{SourceRpm, DebianBinary, DebianSource}, the attribute "buildarch" exists for the three classes when they are mapped, making https://github.com/fedora-static-analysis/firehose/blob/master/tests/test_model.py#L550 fail.
What do you think? |
the ORM uses SQLAlchemy to map Firehose objects with SQL tables.