Ejemplo n.º 1
0
from peewee import *
from playhouse.pool import PooledMySQLDatabase
from configs import common_db_config

max_connections = common_db_config.get('max_connections')
if max_connections is not None:
    database = PooledMySQLDatabase('cmdb', **common_db_config)
else:
    database = MySQLDatabase('cmdb', **common_db_config)


class UnknownField(object):
    pass


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


class AssetNicMac(BaseModel):
    assets = IntegerField(db_column='assets_id', index=True, null=True)
    mac = CharField(null=True)
    nic = CharField(null=True)
    nic_id = PrimaryKeyField()

    class Meta:
        db_table = 'asset_nic_mac'


class Rack(BaseModel):
Ejemplo n.º 2
0
from peewee import *
from playhouse.pool import PooledMySQLDatabase
from configs import common_db_config
max_connections = common_db_config.get('max_connections')
if max_connections is not None:
    database = PooledMySQLDatabase('operator_log', **common_db_config)
else:
    database = MySQLDatabase('operator_log', **common_db_config)


class UnknownField(object):
    pass


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


class AnsibleLog(BaseModel):
    category = CharField(index=True, null=True)
    create_timestamp = DateTimeField(null=True)
    result = TextField(null=True)
    result_status = CharField(index=True, null=True)
    server_ip = CharField(index=True, null=True)

    class Meta:
        db_table = 'ansible_log'


class OperatorLog(BaseModel):