I'd rather just use raw MySQL, but I'm wondering if I'm missing something besides security concerns. Does SQLAlchemy or another ORM handle scaling any better than just using pymysql or MySQLdb?

有帮助吗?

解决方案

Your question is too open to anyone guarantee SQLAlchemy is not a good fit, but SQLAlchemy probably will never be your problem to handle scalability. You'll have to handle almost the same problems with or without SQLAlchemy.

Of course SQLAlchemy has some performance impact, it is a layer above the database driver, but it also will help you a lot.

That said, if you want to use SQLAlchemy to help with your security (SQL escaping), you can use the SQLAlchemy just to execute your raw SQL queries, but I recommend it to fix specific bottlenecks, never to avoid the ORM.

其他提示

SQL Alchemy is generally not faster (esp. as it uses those driver to connect). However, SQL Alchemy will help you structure your data in a sensible way and help keep the data consistent. Will also make it easier for you to migrate to a different db if needed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top