Z
Z
zergon3212017-02-12 22:22:31
MySQL
zergon321, 2017-02-12 22:22:31

Do I need to install something for SQLAlchemy?

At first I tried to install MySQLClient and PyODBC, but then it turned out that for them to work, you need to install a lot more. I also did this, but after that, none of these libraries still wanted to connect to the project. Now I decided to try SQLAlchemy. Do I need to install something for her? OS Ubuntu 16.04.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Momot, 2017-02-12
@zergon321

SQLAlchemy, like many other ORMs, works with drivers - libraries that provide a similar signature API for accessing the database. You can read more about this in this wonderful article with pictures and examples.
The answer to the question: YES, it is necessary, but sometimes NO, it is not necessary. And clarification: depending on what exactly the backend will be in your case. For example: Postgres,
in this case the creation of the "engine" will be done using the dialect + driver declaration line,
and the engine module used will be psycopg2 . This means what you need to do
before you start working with the ORM:
In the case of sqlite, for example, the sqlite3 standard library will be used by default and nothing else needs to be done. Just declare:
engine = create_engine('sqlite://')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question