Opened 13 years ago
Closed 11 years ago
#451 closed enhancement (fixed)
Convert all mongokit style .find, .find_one, .one calls over to SQLAlchemy queries
Reported by: | Christopher Allan Webber | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | programming | Keywords: | bitesized |
Cc: | Elrond, ben@… | Parent Tickets: |
Description
Right now (esp thanks to Elrond) we managed to have a nice transitional period between Mongo and SQL by having mongokit like queries via .find() .find_one() and .one() reproduction for SQLAlchemy. But it's time to remove those from the codebase. We should start removing all instances of those and replacing them with proper queries.
Attachments (2)
Change History (18)
comment:1 by , 13 years ago
Priority: | major → minor |
---|
comment:2 by , 12 years ago
Milestone: | 0.3.1 |
---|
I'm bumping this out of the 0.3.1 milestone. I don't think it was done for 0.3.1 and it's not assigned to anyone.
comment:3 by , 12 years ago
Is this what we have in mind: see my branch 451_mongolisms. Not complete, but a first step.git://gitorious.org/~spaetz/mediagoblin/spaetz-mediagoblin.git
comment:4 by , 12 years ago
I just merged the above branch (master changed from 2783c65 to 70f8b2d) removing mongolisms from auth.views and user_pages. There are still quite a few remaining that need to be done though.
comment:5 by , 12 years ago
Milestone: | → 0.3.3 |
---|---|
Type: | defect → enhancement |
I think, we're done with this for the big part.
The remaining ones can be fixed "on the go". They don't hurt. They're getting handled by our wrapper tools.
I vote for closing.
comment:7 by , 12 years ago
Milestone: | 0.3.3 → 0.3.4 |
---|
If someone wants to pick this up, it's not really a complex ticket, it's just very manual. Moving to 0.3.4 anyway.
comment:8 by , 12 years ago
Keywords: | bitesized added |
---|
comment:9 by , 12 years ago
Milestone: | 0.4.0 |
---|
by , 11 years ago
Attachment: | trac#451-convert_mongokit.diff added |
---|
Replace transitional calls to 'first_one()' with 'filter_by().first()'.
comment:10 by , 11 years ago
Cc: | added |
---|---|
Status: | new → review |
I've attached a patch to replace calls to first_one()
. I'm happy to proceed with the others, but would love someone to take a quick look to make sure I'm on the right track. (Tests still pass)
comment:11 by , 11 years ago
Cc: | added; removed |
---|
comment:13 by , 11 years ago
Status: | review → accepted |
---|
by , 11 years ago
Attachment: | trac#451-convert_mongokit.2.diff added |
---|
Replace transitional calls to 'find_one()', 'find()', and 'one()'.
comment:14 by , 11 years ago
Status: | accepted → review |
---|
Thanks rodney757. I've attached an updated patch replacing all of find_one()
, find()
and one()
.
comment:15 by , 11 years ago
Okay, So I looked over this and everything looks good to me. All tests pass as well.
I talked to cwebb on irc about the db.MediaEntry.query.filter_by()
in gmg_commands/import_export.py
and we agreed that this is probably better then using .query.all() since it returns a query object vs a list.
comment:16 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | review → closed |
Committed! Thanks for the patch.
Elrond seems unsure that we should remove these, last I spoke to him, for this reason: the mongokit-style queries look pretty nice, and they seem to work well. This is true, but I think it's also true that the less types of syntax our devs need to learn, the better.
The result is that I think this is slightly lower priority, but if someone works on this I'll definitely merge it.