本文介绍了SQLAlchemy,Psycopg2和Postgresql COPY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
似乎Psycopg具有用于执行:
It looks like Psycopg has a custom command for executing a COPY:
是否可以通过SQLAlchemy访问此功能?
Is there a way to access this functionality from with SQLAlchemy?
推荐答案
您可能只需要使用psycopg2来公开此功能并放弃ORM功能。我想我还是没有真正看到ORM在这种操作中的好处,因为它是直接的批量插入,并且在ORM中处理单个对象并没有多大意义。
You may have to just use psycopg2 to expose this functionality and forego the ORM capabilities. I guess I don't really see the benefit of ORM in such an operation anyway since it's a straight bulk insert and dealing with individual objects a la an ORM would not really make a whole lot of sense.
这篇关于SQLAlchemy,Psycopg2和Postgresql COPY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!