Opened 11 years ago
Closed 10 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:|
|Cc:||Elrond, ben@…||Parent Tickets:|
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.
Change History (18)
comment:1 by , 11 years ago
|Priority:||major → minor|
comment:2 by , 11 years ago
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 , 11 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 , 10 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 , 10 years ago
|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:6 by , 10 years ago
I think it's worth leaving open until these are closed.
comment:7 by , 10 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 , 10 years ago
comment:9 by , 10 years ago
by , 10 years ago
Replace transitional calls to 'first_one()' with 'filter_by().first()'.
comment:10 by , 10 years ago
|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 , 10 years ago
comment:12 by , 10 years ago
Your one the right track :)
Now only .find and .one to go.
comment:13 by , 10 years ago
|Status:||review → accepted|
by , 10 years ago
Replace transitional calls to 'find_one()', 'find()', and 'one()'.
comment:14 by , 10 years ago
|Status:||accepted → review|
Thanks rodney757. I've attached an updated patch replacing all of
comment:15 by , 10 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
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 , 10 years ago
|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.