Closed Bug 1159220 Opened 9 years ago Closed 8 years ago

Remove dependency on SQLAlchemy

Categories

(Marketplace Graveyard :: Code Quality, enhancement, P4)

enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mat, Unassigned)

References

Details

(Whiteboard: [ktlo])

django-mysql-pool is gone from zamboni with the django 1.7 upgrade.

SQLAlchemy is still here because services/utils.py needs it, because services/verify.py wants to connect to the database manually bypassing the django ORM.

We should consider whether bypassing the ORM is really worth it (might be premature optimization) but more importantly, we should try to use the django connection API instead of manually connecting with SQLAlchemy, there is no point in having a separate dependency just to connect to the database.
https://github.com/diox/zamboni/commit/6af1fecb4088a300e29d9779d6f3e607d60b8c69 should work, but how can I test that I'm not introducing some perf issues with the verifier ?
Severity: normal → enhancement
Priority: -- → P4
andym or kumar might have some ideas
Flags: needinfo?(kumar.mcmillan)
IIRC this was done as actual optimization to the AMO version check service (when it was serving 10,000 requests/sec). But that got ported over to the Marketplace receipt check which doesn't get traffic anywhere near that. 

So... I suppose we could move that service back to Django. That would be a lot of work though. I don't know how easy it would be to replace sqlalchemy with the Django ORM in that service because the service is not Django.
Flags: needinfo?(kumar.mcmillan)
+1 on moving it back in to zamboni and making it Django only. I've suggested this happen (sure I filed bugs on it, can't find them now), it will simplify so many things. SQLAlchemy was used because it was there and convenient, there's no reason you need to keep it around if you can do it a different wya.
(In reply to Kumar McMillan [:kumar] (needinfo for quickness) from comment #3)
> So... I suppose we could move that service back to Django. That would be a
> lot of work though. I don't know how easy it would be to replace sqlalchemy
> with the Django ORM in that service because the service is not Django.

Its well tested, with a full unit test suite in Django, all tables are accessible from models in Django. Shouldn't be too tough, just a bit of grunt work.
Blocks: 1159746
Thanks for the info. I've opened bug 1159746 to deal with migrating it fully to django because it's more work than just getting rid of sqlalchemy (which I'll take right now because it's an easy win).
Assignee: nobody → mpillard
Target Milestone: --- → 2015-05-05
Status: NEW → ASSIGNED
Fixed in https://github.com/mozilla/zamboni/commit/e4dcdc9842853fb71e7e05c9ceefa0b4e846289f

QA:
- Please verify that payment flow still works
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Follow up because of errors (2013, 'Lost connection to MySQL server during query') on stage after a while: https://github.com/mozilla/zamboni/commit/2fab0ae58685c4b95d5e53629c9dad9023126fba
Those 2 commits were reverted in https://github.com/mozilla/zamboni/commit/6c97a47b3e8af6d9699b42687db0e3987e38fdae because dev & stage were still having errors.
Assignee: mpillard → nobody
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 2015-05-05 → ---
Whiteboard: [ktlo]
Payments is trending to close...
Status: REOPENED → RESOLVED
Closed: 9 years ago8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.