當前位置: 首頁>>代碼示例>>Python>>正文


Python sqlite_ext.SqliteExtDatabase方法代碼示例

本文整理匯總了Python中playhouse.sqlite_ext.SqliteExtDatabase方法的典型用法代碼示例。如果您正苦於以下問題:Python sqlite_ext.SqliteExtDatabase方法的具體用法?Python sqlite_ext.SqliteExtDatabase怎麽用?Python sqlite_ext.SqliteExtDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在playhouse.sqlite_ext的用法示例。


在下文中一共展示了sqlite_ext.SqliteExtDatabase方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: makedb

# 需要導入模塊: from playhouse import sqlite_ext [as 別名]
# 或者: from playhouse.sqlite_ext import SqliteExtDatabase [as 別名]
def makedb(dbfile):
    db = SqliteExtDatabase(dbfile)
    db.connect()

    global BaseModel
    class BaseModel(Model):
        class Meta:
            database = db

    global UniqueString
    class UniqueString(BaseModel):
        raw = CharField(index=True)
        count = IntegerField()
        malware_count = IntegerField()
        p_malware = FloatField(index=True)

    global Entity
    class Entity(BaseModel):
        name = CharField(index=True)
        label = FloatField()

    global String
    class String(BaseModel):
        uniquestring = ForeignKeyField(UniqueString,index=True)
        entity = ForeignKeyField(Entity,index=True)
        source = CharField(index=True,null=True)

    # create database
    db.create_tables([Entity,String,UniqueString])

    return db 
開發者ID:joshsaxe,項目名稱:eXposeDeepNeuralNetwork,代碼行數:33,代碼來源:db.py

示例2: __get_migrator

# 需要導入模塊: from playhouse import sqlite_ext [as 別名]
# 或者: from playhouse.sqlite_ext import SqliteExtDatabase [as 別名]
def __get_migrator(self):
		if isinstance(self.db.engine, peewee.SqliteDatabase) or isinstance(self.db.engine, SqliteExtDatabase):
			return SqliteMigrator(self.db.engine)
		elif isinstance(self.db.engine, peewee.MySQLDatabase):
			return MySQLMigrator(self.db.engine)
		elif isinstance(self.db.engine, peewee.PostgresqlDatabase):
			return PostgresqlMigrator(self.db.engine)
		raise ImproperlyConfigured('Database engine doesn\'t support Migrations!') 
開發者ID:PyPlanet,項目名稱:PyPlanet,代碼行數:10,代碼來源:migrator.py


注:本文中的playhouse.sqlite_ext.SqliteExtDatabase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。