M
M
maqstein2019-03-10 02:38:13
Python
maqstein, 2019-03-10 02:38:13

What are the advantages and disadvantages of using sqlalchemy over psycopg2?

I am writing a small project, I don’t know what to choose between, on the one hand, psycopg2 is quite readable in code and more understandable to me, on the other hand, sqlalchemy is a more general version of communicating with the database, but less understandable to me. I would like to know the advantages and disadvantages of each of the
PS options, as far as I understand in terms of performance, the difference is not great, since psycopg is a database driver and sqlalchemy still accesses it to work with the PSS database in the database,
I only need CRUD

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2019-03-10
@maqstein

For learning - first use a pure driver, and then alchemy
Try to write code in a clean one, so as not to do sqlinj

S
Sergey Gornostaev, 2019-03-10
@sergey-gornostaev

You are wrong about performance, ORM will always be slower than queries. And ORM will never be as flexible. But then ORM isolates you from the specifics of specific DBMS, and your project can move from MySQL to PostgreSQL without changes, if necessary. In addition, ORM is easier to work with and it is possible to find errors by static analysis.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question