Purpose of SQLAlchemy over MYSQL CONNECTOR PYTHON

hgqdbh6s  于 2022-12-22  发布在  Mysql
关注(0)|答案(2)|浏览(107)

I am new to working with databases and couldn't find any relevant answers for this. What are the uses of SQLAlchemy over MYSQL CONNECTOR for python.

yebdmbv4

yebdmbv41#

I do not have much experience with MYSQL CONNECTOR for Python. However, from what I know SQLAlchemy primarily uses ORM (Object-Relational Mapping) in order to abstract the details of handling the database. This can help avoid errors some times (and also introduce possibly introduce others). You might want to have a look at the ORM technique and see if it is for you (but don't use it as a way to avoid learning SQL). Generally, ORMs tend not to be as scalable as raw SQL either.

hgtggwj0

hgtggwj02#

I am also a newbie. In my understanding SQLAlchemy is an ORM (Object-Relational Mapping) that allows you to abstract the database and query data from the DB more easily in your coding language treating query data as another object. Pros is that that you can more easily switch your DB under the hood. But it has some learning curve.
Whereas MySQL Connector is "just" a plain simple direct connection to the DBMS at your database and you write SQL queries to get the data.
For now I am sticking with the mysql connector to just train SQL queries more. But later on I will definitely test out SQLAlchemy.

相关问题