本文整理汇总了Python中stalker.db.session.DBSession.remove方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.remove方法的具体用法?Python DBSession.remove怎么用?Python DBSession.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stalker.db.session.DBSession
的用法示例。
在下文中一共展示了DBSession.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def setup(settings=None):
"""Utility function that helps to connect the system to the given database.
if the database is None then the it setups using the default database in
the settings file.
:param settings: This is a dictionary which has keys prefixed with
"sqlalchemy" and shows the settings. The most important one is the
engine. The default is None, and in this case it uses the settings from
stalker.config.Config.database_engine_settings
"""
if settings is None:
settings = defaults.database_engine_settings
logger.debug("no settings given, using the default: %s" % settings)
logger.debug("settings: %s" % settings)
# create engine
engine = engine_from_config(settings, "sqlalchemy.")
logger.debug("engine: %s" % engine)
# create the Session class
DBSession.remove()
DBSession.configure(bind=engine, extension=None)
# create the database
logger.debug("creating the tables")
Base.metadata.create_all(engine)
# update defaults
update_defaults_with_studio()
示例2: tearDown
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDown(self):
os.rmdir(self.test_repo.linux_path)
os.rmdir(self.test_repo.windows_path)
os.rmdir(self.test_repo.osx_path)
DBSession.remove()
testing.tearDown()
示例3: setup
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def setup(settings=None):
"""Utility function that helps to connect the system to the given database.
if the database is None then the it setups using the default database in
the settings file.
:param settings: This is a dictionary which has keys prefixed with
"sqlalchemy" and shows the settings. The most important one is the
engine. The default is None, and in this case it uses the settings from
stalker.config.Config.database_engine_settings
"""
if settings is None:
settings = defaults.database_engine_settings
logger.debug('no settings given, using the default: %s' % settings)
logger.debug("settings: %s" % settings)
# create engine
engine = engine_from_config(settings, 'sqlalchemy.')
logger.debug('engine: %s' % engine)
# create the Session class
DBSession.remove()
DBSession.configure(
bind=engine,
extension=None
)
# check alembic versions of the database
# and raise an error if it is not matching with the system
check_alembic_version()
# create the database
logger.debug("creating the tables")
Base.metadata.create_all(engine)
# update defaults
update_defaults_with_studio()
# create repo env variables
create_repo_vars()
示例4: setUpClass
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def setUpClass(cls):
"""set up the test for class
"""
DBSession.remove()
示例5: tearDown
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDown(self):
"""tear down the test
"""
DBSession.remove()
示例6: tearDown
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDown(self):
"""clean up the test
"""
DBSession.remove()
示例7: tearDownClass
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDownClass(cls):
"""clear test in class level
"""
DBSession.remove()
示例8: setUpClass
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def setUpClass(cls):
"""setup test in class level
"""
DBSession.remove()
示例9: tearDown
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDown(self):
from stalker.db.session import DBSession
DBSession.remove()
示例10: Status
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
from stalker import db, User
from stalker.models.asset import Asset
from stalker.models.project import Project
from stalker.models.repository import Repository
from stalker.db.session import DBSession
from stalker.models.status import Status, StatusList
from stalker.models.task import Task
from stalker.models.type import Type
DBSession.remove()
DBSession.configure(extension=None)
db.setup()
status1 = Status(name="Complete", code="CMPLT")
status2 = Status(name="Pending Review", code="PRev")
repo1 = Repository(name="TestRepo")
project_status_list = StatusList(
name="test",
target_entity_type=Project,
statuses=[status1]
)
project_type = Type(
示例11: tearDown
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDown(self):
"""clean up the test
"""
DBSession.remove()
# restore defaults.timing_resolution
defaults.timing_resolution = datetime.timedelta(hours=1)
示例12: tearDown
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDown(self):
DBSession.remove()
testing.tearDown()
示例13: tearDownClass
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDownClass(cls):
"""cleanup the test in class level
"""
DBSession.remove()
DBSession.configure()
示例14: setUpClass
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def setUpClass(cls):
"""setup the test in class level
"""
DBSession.remove()
DBSession.configure()
示例15: tearDownClass
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def tearDownClass(cls):
"""clean up the test
"""
DBSession.remove()