Search code examples
pythondatabaseormtwisted

how to manage db schema in a python twisted application?


I am over accustomed to Django ORM and feel handicapped when trying to build a standalone python-twisted application which needs database integration.

SQLAlchemy looks promising - true. But I am trying to tinker with twisted as well and am unable to find anything on the lines of a good async python orm.

what I have found (https://stackoverflow.com/a/1705987/338691) would force me to write raw sql queries - doesn't feel quite right after my elongated stint with django.

So how does one play with database schema in a twisted application?


Solution

  • There is also http://findingscience.com/twistar/ which unfortunately follows the Active Record pattern and last time I checked, the author feels that migrations are out of scope of the project. So you would end up writing migrations manually anyway (maybe there could be some adapter for alembic for that, that would be cool).

    Also I remember seeing github repo where the author tries to make twisted play nicely with sqlalchemy (without deferToThread) but I haven't followed to see if it was a success and can't find the URL. (also Twisted + SQLAlchemy and the best way to do it)

    And lastly, recent versions of psycopg supports setting an async callback. Maybe that could be leveraged to something (integration with SQLAlchemy? or something).

    UPDATE: also recently appeared this interesting project - alchimia