V
V
Valery Semenov2012-09-12 09:18:35
Python
Valery Semenov, 2012-09-12 09:18:35

How to learn sqlalchemy?

i am new to python. I decided to start my study with a home project. I decided to work with the database using sqlalchemy. In this connection, questions arose:
- What is the correct way to design models? (best practice)
- on which modules to scatter (where to store configs, session, models themselves)
- if there is a good repository on github that actively uses sqlalchemy, please tell me - I will study.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ks_ks, 2012-09-12
@ks_ks

It would be nice to know what you already know about this - what kind of work experience do you have,
and in fact, what exactly do you want to know as part of this project ...
well, to the heap - what projects would you be interested in.
And so, the universal answer - open the dock, read, execute examples ...

F
FanKiLL, 2012-09-12
@FanKiLL

As for sessions, if you use some kind of framework, see if a wrapper for SQLAlchemy is implemented for it.
For example, SQLAlchemy developers recommend using for Flask - packages.python.org/Flask-SQLAlchemy/
for Zope & Pyramid - pypi.python.org/pypi/zope.sqlalchemy
Configs can be stored in a separate classconfig.py

class Config:
    DEBUG = False
    POST_PER_PAGE = 20
    etc ......

As for the models, it’s also interesting, I would like to see the implementation of each model in its own file, so that it would be easier to maintain, otherwise everything is usually in one file and when there are a lot of models, hell begins. I somehow tried to play, ran into cyclic import and spat.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question