Opened 12 years ago

Closed 11 years ago

#557 closed task (fixed)

RIP out Mongo support

Reported by: spaetz Owned by:
Priority: major Milestone:
Component: programming Keywords: bitesized
Cc: Parent Tickets:

Description

Now that we have transitioned from Mongo to SQL, and sqlalchemy is providing our database abstraction, it does not make lots of sense to abstract away the database abstraction layer.

I seriously suggest ripping out Mongo. I have actually done that with no ill side-effects (besides not supporting Mongo anymore) in this branch:

WIP/RIP_mongo repo: git://gitorious.org/~spaetz/mediagoblin/spaetz-mediagoblin.git

This leads to quite some code simplification:

45 files changed, 1518 insertions(+), 3107 deletions(-)

the removing of an additional lookup layer and possibilities for further optimizations. (Such as transitioning away from the mongo-style alias "_id" to the "id" field that we actually use)

Change History (7)

comment:1 by spaetz, 12 years ago

In parallel to ripping out mongo, here is a branch that transitions us from modelobject._id to modelobject.id. This causes *lots* of indirect lookups and fixups in basically all queries that we should avoid. Also Mongo is already broken with some newer code that refers to modelobject.id. The branch is here: WIP/removeid_alias and can be applied before or after ripping Mongo out (or be merged without ripping Mongo, it will just be a little more broken than it currently is)

Version 0, edited 12 years ago by spaetz (next)

comment:2 by Elrond, 12 years ago

To be honest, I don't want to review """45 files changed, 1518 insertions(+), 3107 deletions(-)""". But I think, we should slowly start to rip out mongo stuff. Like ripping out db/mongo/.

comment:3 by Christopher Allan Webber, 12 years ago

Keywords: bitesized added

So, I'm marking this as bitesized, even though it's "only bitesized in ability, not size" :)

To complete this task, we need to remove all .find(), .find_one(), and .one() style calls in MediaGoblin's codebase.

You should be able to remove these three methods:

class GMGTableBase(object):
    query = Session.query_property()

    # start things to remove
    @classmethod
    def find(cls, query_dict):
        return cls.query.filter_by(**query_dict)

    @classmethod
    def find_one(cls, query_dict):
        return cls.query.filter_by(**query_dict).first()

    @classmethod
    def one(cls, query_dict):
        return cls.find(query_dict).one()
    # end things to remove

from mediagoblin/db/base.py and everything should still work.

comment:4 by Christopher Allan Webber, 12 years ago

comment:5 by praveen97uma, 12 years ago

Owner: set to praveen97uma
Status: newassigned

comment:6 by Christopher Allan Webber, 12 years ago

Status: assignedin_progress

Hi! I'm moving this ticket from "assigned" to in_progress per our new workflow. Please update the ticket and let us know if you're still working on this. If you are, super great! If not, we'll remove the claim and move it back to "accepted" in a couple of weeks.

Thanks!

comment:7 by Christopher Allan Webber, 11 years ago

Owner: praveen97uma removed
Resolution: fixed
Status: in_progressclosed

This is done, I'm pretty sure. Closing!

Note: See TracTickets for help on using tickets.