Example #1
0
def setversion(env):
    '''
    Manually set the alembic version of the
    database to the provided value.
    '''
    init_for(env)
    config = FlaskAlembicConfig("alembic.ini")
    version = raw_input("Enter the alembic version to be set:")
    command.stamp(config, version)
Example #2
0
from __future__ import with_statement
from alembic import context
from alembic.config import Config
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI'))
    flask_app = __import__('%s' % (current_app.name), fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
Example #3
0
__FILENAME__ = env
from __future__ import with_statement
from alembic import context
from alembic.config import Config
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url',
                           current_app.config.get('SQLALCHEMY_DATABASE_URI'))
    flask_app = __import__('%s' % (current_app.name),
                           fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

# other values from the config, defined by the needs of env.py,
Example #4
0
def create(env):
    "Creates database tables from sqlalchemy models"
    init_for(env)
    db.create_all()
    config = FlaskAlembicConfig("alembic.ini")
    command.stamp(config, "head")
Example #5
0
from __future__ import with_statement
from alembic import context
from alembic.config import Config
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option(
        'sqlalchemy.url',
        current_app.config.get('SQLALCHEMY_BINDS', {}).get('lastuser', None))
    flask_app = __import__('%s' % (current_app.name),
                           fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

# other values from the config, defined by the needs of env.py,
Example #6
0
from __future__ import with_statement
from alembic import context
from alembic.config import Config
from sqlalchemy import engine_from_config, pool
from flask.ext.sqlalchemy import SQLAlchemy
from logging.config import fileConfig
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("aurora_app/migrations/alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url',
                           current_app.config.get('SQLALCHEMY_DATABASE_URI'))
    flask_app = __import__('%s' % ('aurora_app'),
                           fromlist=[current_app.name]).create_app()

db_obj = SQLAlchemy(flask_app)
target_metadata = db_obj.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
Example #7
0
File: env.py Project: ak3n/aurora
from __future__ import with_statement
from alembic import context
from alembic.config import Config
from sqlalchemy import engine_from_config, pool
from flask.ext.sqlalchemy import SQLAlchemy
from logging.config import fileConfig
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("aurora_app/migrations/alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI'))
    flask_app = __import__('%s' % ('aurora_app'), fromlist=[current_app.name]).create_app()

db_obj = SQLAlchemy(flask_app)
target_metadata = db_obj.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
Example #8
0
from __future__ import with_statement
from alembic import context
from alembic.config import Config
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_BINDS', {}).get('lastuser', None))
    flask_app = __import__('%s' % (current_app.name), fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.