当前位置: 首页>>代码示例>>Python>>正文


Python SqliteDatabase.create_table方法代码示例

本文整理汇总了Python中peewee.SqliteDatabase.create_table方法的典型用法代码示例。如果您正苦于以下问题:Python SqliteDatabase.create_table方法的具体用法?Python SqliteDatabase.create_table怎么用?Python SqliteDatabase.create_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在peewee.SqliteDatabase的用法示例。


在下文中一共展示了SqliteDatabase.create_table方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: from peewee import SqliteDatabase [as 别名]
# 或者: from peewee.SqliteDatabase import create_table [as 别名]
def init(dbname="blender-models.db"):
    db = SqliteDatabase(path.join(MORSEWEB_ROOT, dbname))
    db.connect()

    if not BlenderModel.table_exists():
        db.create_table(BlenderModel)

    for pathname in RESOURCES:
        populate(pathname)
开发者ID:yarox,项目名称:morseweb,代码行数:11,代码来源:autoexport.py

示例2: init

# 需要导入模块: from peewee import SqliteDatabase [as 别名]
# 或者: from peewee.SqliteDatabase import create_table [as 别名]
def init():
    path = os.path.expanduser('~/.config/aesop/database.db')

    global database
    database = SqliteDatabase(path)
    database_proxy.initialize(database)
    database.connect()

    for model in BaseModel.__subclasses__():
        try:
            database.create_table(model)
        except Exception:
            pass
        else:
            if model == Config:
                Config.create_default()
开发者ID:nathan-hoad,项目名称:aesop,代码行数:18,代码来源:models.py

示例3: empty

# 需要导入模块: from peewee import SqliteDatabase [as 别名]
# 或者: from peewee.SqliteDatabase import create_table [as 别名]
 def empty(self, *args, **options):
     """
     Creates an empty content database for the Khan channel. This ensures
     that an empty content database exists in the default distribution and
     for tests.
     
     Especially useful for creating an *EMPTY TEMPLATE*
     
     retrievecontentpack empty en --template
     """
     lang = args[1]
     if not options.get('template', False):
         content_db_path = topic_settings.CONTENT_DATABASE_PATH.format(
             channel=topic_settings.CHANNEL,
             language=lang,
         )
     else:
         content_db_path = topic_settings.CONTENT_DATABASE_TEMPLATE_PATH.format(
             channel=topic_settings.CHANNEL,
             language=lang,
         )
     if os.path.exists(content_db_path):
         if options.get("force", False):
             os.unlink(content_db_path)
         else:
             raise CommandError(
                 "Content database already exists: {}".format(
                     content_db_path
                 )
             )
     db = SqliteDatabase(
         content_db_path
     )
     db.connect()
     db.create_table(Item, safe=True)
     db.create_table(AssessmentItem, safe=True)
     db.close()
     self.complete(
         _("Saved empty content database in {}.").format(
             content_db_path
         )
     )
开发者ID:learningequality,项目名称:ka-lite,代码行数:44,代码来源:retrievecontentpack.py

示例4: create_database

# 需要导入模块: from peewee import SqliteDatabase [as 别名]
# 或者: from peewee.SqliteDatabase import create_table [as 别名]
def create_database():
    with open('data.db', 'w+') as f:
        f.write('')
    db = SqliteDatabase('data.db')
    db.connect()
    db.create_table(Client)
开发者ID:akruszewski,项目名称:kw,代码行数:8,代码来源:create_database.py


注:本文中的peewee.SqliteDatabase.create_table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。