本文整理汇总了Python中migrate.versioning.api.version函数的典型用法代码示例。如果您正苦于以下问题:Python version函数的具体用法?Python version怎么用?Python version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:iepathos,项目名称:flask-microblog,代码行数:7,代码来源:manager.py
示例2: version
def version(self):
url = cfg.CONF['storage:sqlalchemy'].database_connection
current = versioning_api.db_version(url=url, repository=REPOSITORY)
latest = versioning_api.version(repository=REPOSITORY).value
print("Current: %s Latest: %s" % (current, latest))
开发者ID:gvnkd,项目名称:designate,代码行数:7,代码来源:database.py
示例3: createdb
def createdb():
""" Creates a database with all of the tables defined in
the SQLAlchemy models. Creates and initializes an
SQLAlchemy-migrate repository if none exists.
"""
# Create New DB Reflecting SQLAlchemy Data Models
db.create_all(app=app)
admin = User('admin', '/home/admin', 'password')
db.session.add(admin)
db.session.commit()
# Create SQLAlchemy-migrate Versioning Repository If Absent
if not os.path.exists(app.config['SQLALCHEMY_MIGRATE_REPO']):
api.create(app.config['SQLALCHEMY_MIGRATE_REPO'],
'database repository')
api.version_control(app.config['SQLALCHEMY_DATABASE_URI'],
app.config['SQLALCHEMY_MIGRATE_REPO'])
print "SQLAlchemy-migrate Versioning Repository Created in: " +\
app.config['SQLALCHEMY_MIGRATE_REPO']
else:
api.version_control(app.config['SQLALCHEMY_DATABASE_URI'],
app.config['SQLALCHEMY_MIGRATE_REPO'],
api.version(
app.config['SQLALCHEMY_MIGRATE_REPO']))
print "Database created in: " + app.config['SQLALCHEMY_DATABASE_URI']
开发者ID:ikinsella,项目名称:squall,代码行数:26,代码来源:manage.py
示例4: create_database
def create_database():
db.create_all()
if not os.path.exists(c.SQLALCHEMY_MIGRATE_REPO):
api.create(c.SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(c.SQLALCHEMY_DATABASE_URI, c.SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(c.SQLALCHEMY_DATABASE_URI, c.SQLALCHEMY_MIGRATE_REPO, api.version(c.SQLALCHEMY_MIGRATE_REPO))
开发者ID:jharkins,项目名称:webapp-template,代码行数:7,代码来源:db_manage.py
示例5: version
def version(self, pool_id):
pool = self.central_api.find_pool(self.context, {"id": pool_id})
for pool_target in pool.targets:
current = get_manager(pool_target).version()
latest = versioning_api.version(repository=REPOSITORY).value
print("Current: %s Latest: %s" % (current, latest))
开发者ID:ISCAS-VDI,项目名称:designate-base,代码行数:7,代码来源:powerdns.py
示例6: _setup
def _setup(config):
# disable delayed execution
# config['adhocracy.amqp.host'] = None
# FIXME: still do this with rq instead of rabbitmq
# NOTE: this is called from tests so it may have side effects
# Create the tables if they don't already exist
url = config.get('sqlalchemy.url')
migrate_repo = os.path.join(os.path.dirname(__file__), 'migration')
repo_version = migrateapi.version(migrate_repo)
if config.get('adhocracy.setup.drop', "OH_NOES") == "KILL_EM_ALL":
meta.data.drop_all(bind=meta.engine)
meta.engine.execute("DROP TABLE IF EXISTS migrate_version")
try:
db_version = migrateapi.db_version(url, migrate_repo)
if db_version < repo_version:
migrateapi.upgrade(url, migrate_repo)
initial_setup = False
except DatabaseNotControlledError:
meta.data.create_all(bind=meta.engine)
migrateapi.version_control(url, migrate_repo, version=repo_version)
initial_setup = True
install.setup_entities(config, initial_setup)
开发者ID:whausen,项目名称:part,代码行数:26,代码来源:websetup.py
示例7: create_db
def create_db():
Base.metadata.create_all(engine)
if not path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
M1A = Module(name=u'M1A', slot=1, gpio=8, io_type='input', rpull=False, status=False, device_id='')
M1B = Module(name=u'M1B', slot=1, gpio=7, io_type='input', rpull=False, status=False, device_id='')
M1C = Module(name=u'M1C', slot=1, gpio=11, io_type='input', rpull=False, status=False, device_id='')
M2A = Module(name=u'M2A', slot=2, gpio=9, io_type='input', rpull=False, status=False, device_id='')
M2B = Module(name=u'M2B', slot=2, gpio=10, io_type='input', rpull=False, status=False, device_id='')
M2C = Module(name=u'M2C', slot=2, gpio=5, io_type='input', rpull=False, status=False, device_id='')
M3A = Module(name=u'M3A', slot=3, gpio=6, io_type='input', rpull=False, status=False, device_id='')
M3B = Module(name=u'M3B', slot=3, gpio=12, io_type='input', rpull=False, status=False, device_id='')
M3C = Module(name=u'M3C', slot=3, gpio=13, io_type='input', rpull=False, status=False, device_id='')
M4A = Module(name=u'M4A', slot=4, gpio=0, io_type='input', rpull=False, status=False, device_id='')
M4B = Module(name=u'M4B', slot=4, gpio=1, io_type='input', rpull=False, status=False, device_id='')
M4C = Module(name=u'M4C', slot=4, gpio=16, io_type='input', rpull=False, status=False, device_id='')
M5A = Module(name=u'M5A', slot=5, gpio=17, io_type='input', rpull=False, status=False, device_id='')
M5B = Module(name=u'M5B', slot=5, gpio=18, io_type='input', rpull=False, status=False, device_id='')
M5C = Module(name=u'M5C', slot=5, gpio=19, io_type='input', rpull=False, status=False, device_id='')
M6A = Module(name=u'M6A', slot=6, gpio=20, io_type='input', rpull=False, status=False, device_id='')
M6B = Module(name=u'M6B', slot=6, gpio=21, io_type='input', rpull=False, status=False, device_id='')
M6C = Module(name=u'M6C', slot=6, gpio=22, io_type='input', rpull=False, status=False, device_id='')
M7A = Module(name=u'M7A', slot=7, gpio=23, io_type='input', rpull=False, status=False, device_id='')
M7B = Module(name=u'M7B', slot=7, gpio=24, io_type='input', rpull=False, status=False, device_id='')
M7C = Module(name=u'M7C', slot=7, gpio=25, io_type='input', rpull=False, status=False, device_id='')
modules = [M1A, M1B, M1C, M2A, M2B, M2C, M3A, M3B, M3C, M4A, M4B, M4C,
M5A, M5B, M5C, M6A, M6B, M6C, M7A, M7B, M7C]
for m in modules:
session.add(m)
session.commit()
开发者ID:TemosEngenharia,项目名称:RPI-IO,代码行数:34,代码来源:models.py
示例8: create
def create():
print '{} is being instantiated now!'.format(SQLALCHEMY_DATABASE_URI)
orm_db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:martinhbramwell,项目名称:evalOfFlask,代码行数:8,代码来源:dbUtil.py
示例9: init_db
def init_db():
import models
Base.metadata.create_all(bind=engine)
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:danthepunman,项目名称:catalog,代码行数:8,代码来源:database.py
示例10: create_db_and_update
def create_db_and_update(db_uri, migrate_repo):
if not os.path.exists(migrate_repo):
api.create(migrate_repo, 'database repository')
api.version_control(db_uri, migrate_repo)
else:
api.version_control(db_uri,
migrate_repo,
api.version(migrate_repo))
开发者ID:danrr,项目名称:SELP,代码行数:8,代码来源:db_create.py
示例11: __init__
def __init__(self):
database.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_CONT):
api.create(SQLALCHEMY_MIGRATE_CONT, "database container")
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_CONT)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_CONT, api.version(SQLALCHEMY_MIGRATE_CONT))
开发者ID:Persipaani,项目名称:blogi,代码行数:8,代码来源:create_db.py
示例12: create_db
def create_db(self):
self.metadata.create_all(bind=self.metadata.bind)
# sqlalchemy migrate hack
from migrate.versioning.api import version_control, version
import shakespeare.migration.versions
v = version(shakespeare.migration.__path__[0])
log.info( "Setting current version to '%s'" % v )
version_control(self.metadata.bind.url, shakespeare.migration.__path__[0], v)
开发者ID:deeban25,项目名称:shakespeare,代码行数:8,代码来源:__init__.py
示例13: create
def create():
create_engine(SQLALCHEMY_DATABASE_URI, echo=True)
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO,
api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:xiaobaozi34,项目名称:wordseer,代码行数:8,代码来源:database.py
示例14: CreateDB
def CreateDB():
print ("Creating DB")
db.create_all()
print ("Putting DB under version control")
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:edunuke,项目名称:istmex,代码行数:9,代码来源:db_create.py
示例15: create_db
def create_db():
from migrate.versioning import api
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:dpsmartws,项目名称:PROM.ua-Test-work,代码行数:9,代码来源:run.py
示例16: create_mg
def create_mg():
'''
初始化数据迁移仓库
'''
if not os.path.exists(MG_REPO):
api.create(MG_REPO, 'database respository')
api.version_control(DB_URI, MG_REPO)
else:
api.version_control(DB_URI, MG_REPO, api.version(MG_REPO))
开发者ID:Andor-Z,项目名称:My-Learning-Note,代码行数:9,代码来源:db_migrate.py
示例17: main
def main(parser, options, args):
engine_url = config["sqlalchemy.url"]
latest_version = version(migrate_repository)
try:
version_control(engine_url, migrate_repository, version=initial_version, echo=DEBUG)
except DatabaseAlreadyControlledError:
pass
upgrade(engine_url, migrate_repository, version=latest_version, echo=DEBUG)
sys.exit(0)
开发者ID:jamielkl,项目名称:mediacore-community,代码行数:9,代码来源:upgrade_from_v072.py
示例18: create_db
def create_db():
db.session.rollback()
db.drop_all()
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database_repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:newmight2015,项目名称:MeetingRomantic,代码行数:9,代码来源:db_create.py
示例19: db_create
def db_create():
"""Create database."""
from migrate.versioning import api
from wpcgi.db import db
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
开发者ID:nullzero,项目名称:wpcgi,代码行数:10,代码来源:runner.py
示例20: create_db
def create_db():
try:
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
except DatabaseAlreadyControlledError:
print 'sqldb alread exists'
开发者ID:wavegu,项目名称:ACE9,代码行数:10,代码来源:create_db.py
注:本文中的migrate.versioning.api.version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论