Opened 8 years ago

Closed 7 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)

Subtickets

Change History (7)

comment:1 Changed 8 years ago by spaetz

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/remove__id_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)

Last edited 8 years ago by spaetz (previous) (diff)

comment:2 Changed 8 years ago by Elrond

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 Changed 7 years ago by Christopher Allan Webber

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 Changed 7 years ago by Christopher Allan Webber

comment:5 Changed 7 years ago by praveen97uma

Owner: set to praveen97uma
Status: newassigned

comment:6 Changed 7 years ago by Christopher Allan Webber

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 Changed 7 years ago by Christopher Allan Webber

Owner: praveen97uma deleted
Resolution: fixed
Status: in_progressclosed

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

Note: See TracTickets for help on using tickets.