| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
The cleanup could be missed if the request handling code in
app.py:__call__ exits early (due to exception, or due to
one of those early "return"s).
So to make sure the sql session is cleaned up for real,
wrap the whole thing in a try: finally:.
Also wrote a short tool to test if the session is actually
empty. The tool is currently disabled, but ready to be
used.
|
|
|
|
|
| |
Load all models for the media_types. This was stopped by a
celery problem. But that is now fixed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
So all models are ready when connecting to the db and so
our "db" object has all models listed on it, create a
function to load all models from the media_types, etc. Call
it in setup_database()
Problem: This gives celery warnings, because celery is
imported before being setup properly. No idea how to fix
this now. So media-type loading is excluded from
load_models for now.
|
|
|
|
|
| |
Import the "Base" class for models from db.sql.base instead
of db.sql.models.
|
|
|
|
|
|
| |
As the queries are quite verbose, disable them for now.
Reenabling them should be done in the central logging
config, which is another story for celery and bin/gmg.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Docs:
http://docs.sqlalchemy.org/en/latest/core/engines.html#configuring-logging
So for an application utilizing python logging for real
(and MediaGoblin should) the rule is:
- Don't use echo=True,
- but reconfigure the appropiate loggers' level.
So replaced the echo=True by a line to reconfigure the
appropiate logger to achieve the same effect.
This still dumps whole bloats of SQL queries into the main
log, but at least they're not duped any more.
|
|
|
|
|
|
|
|
|
|
|
| |
It's good practice to cleanup the SQL session after each
request so that the next request gets a fresh one.
It's an application decision whether one wants a
just-in-case ROLLBACK or COMMIT. There are two ideas behind
it, really. I have decided for ROLLBACK. The idea is "if
you forget to commit your changes yourself, there's
something broken. Maybe you got an exception?".
|
| |
|
|
|
|
|
|
| |
Nearly all the sql files missed a copyright header.
So added it!
And while there fixed a few pep8 things.
|
|
|
|
|
|
|
|
|
|
| |
When initializing the database connection the current mongo
based setup checked for new migrations and warned about
them. This was mongo specific so factor'd it out into a
more generic check_db_migrations_current function in the
mongo backend.
Also created a dummy one in the sql backend.
|
|
In trying to ease the migration to SQL, created an
interface to sqlalchemy that looks a lot like the interface
that is currently in use.
*WARNING* Work in progress
|