SQLAlchemy和django,它的生产准备好了吗? [英] SQLAlchemy and django, is it production ready?

查看:165
本文介绍了SQLAlchemy和django,它的生产准备好了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了 Django 的ORM吗?


$除了 SQLAlchemy b $ b

我想使用Django的ORM对象操作和SQLalchemy的复杂查询(像那些需要左外连接)。



有可能吗?



注意:我知道 django-sqlalchemy 但是项目似乎没有准备好生产。

解决方案

我会做什么,


  1. 在Django orm中定义模式,让它通过syncdb写入db。


  2. 在view1中,您需要一个复杂的连接

     

    def view1(request):
    import sqlalchemy
    data = sqlalchemy.complex_join_magic )
    ...
    payload = {'data':data,...}
    return render_to_response('template',payload,...)


    Has anyone used SQLAlchemy in addition to Django's ORM?

    I'd like to use Django's ORM for object manipulation and SQLalchemy for complex queries (like those that require left outer joins).

    Is it possible?

    Note: I'm aware about django-sqlalchemy but the project doesn't seem to be production ready.

    解决方案

    What I would do,

    1. Define the schema in Django orm, let it write the db via syncdb. You get the admin interface.

    2. In view1 you need a complex join

    
        def view1(request):
           import sqlalchemy
           data = sqlalchemy.complex_join_magic(...)
           ...
           payload = {'data': data, ...}
           return render_to_response('template', payload, ...)
    
    

    这篇关于SQLAlchemy和django,它的生产准备好了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆