Beispiel #1
0
def _setSession(echo=False, filename=None):
    filename = filename or configure.get('SQL_FILE')
    engine = sql.create_engine(db.urlFromFile(filename), echo=echo)
    tables.Base.metadata.create_all(engine)
    Session = orm.sessionmaker(bind=engine)
    session = Session()
    db.setSession(session)
Beispiel #2
0
def _setSession(echo=False, filename=None):
    filename = filename or configure.get('SQL_FILE')
    engine = sql.create_engine(db.urlFromFile(filename), echo=echo)
    tables.Base.metadata.create_all(engine)
    Session = orm.sessionmaker(bind=engine)
    session = Session()
    db.setSession(session)
Beispiel #3
0
import os.path

import sqlalchemy

from porntool import configure
from porntool import db
from porntool import tables

configure.load()

SQL_FILE = configure.get('SQL_FILE')
if not SQL_FILE:
    raise Exception(
        'The location of the database (SQL_FILE) is not specified.')

if os.path.exists(SQL_FILE):
    raise Exception("The file %s already exists.  Can't create database",
                    SQL_FILE)

engine = sqlalchemy.create_engine(db.urlFromFile(SQL_FILE), echo=False)
tables.Base.metadata.create_all(engine)
print "Succesfully created a new database: {}".format(SQL_FILE)
Beispiel #4
0
import os.path

import sqlalchemy

from porntool import configure
from porntool import db
from porntool import tables

configure.load()

SQL_FILE = configure.get('SQL_FILE')
if not SQL_FILE:
    raise Exception('The location of the database (SQL_FILE) is not specified.')

if os.path.exists(SQL_FILE):
    raise Exception("The file %s already exists.  Can't create database", SQL_FILE)

engine = sqlalchemy.create_engine(db.urlFromFile(SQL_FILE), echo=False)
tables.Base.metadata.create_all(engine)
print "Succesfully created a new database: {}".format(SQL_FILE)