本文整理汇总了Python中datasource.bases.BaseHub.BaseHub.add_data_source方法的典型用法代码示例。如果您正苦于以下问题:Python BaseHub.add_data_source方法的具体用法?Python BaseHub.add_data_source怎么用?Python BaseHub.add_data_source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datasource.bases.BaseHub.BaseHub
的用法示例。
在下文中一共展示了BaseHub.add_data_source方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dhub
# 需要导入模块: from datasource.bases.BaseHub import BaseHub [as 别名]
# 或者: from datasource.bases.BaseHub.BaseHub import add_data_source [as 别名]
def dhub(self, procs_file_name):
"""
Return a configured ``DataHub`` using the given SQL procs file.
"""
data_source = {
self.key: {
# @@@ this should depend on self.type
# @@@ shouldn't have to specify this here and below
"hub": "MySQL",
"master_host": {
"host": self.host,
"user": settings.DATAZILLA_DATABASE_USER,
"passwd": settings.DATAZILLA_DATABASE_PASSWORD,
},
"default_db": self.name,
"procs": [
os.path.join(SQL_PATH, procs_file_name),
os.path.join(SQL_PATH, "generic.json"),
],
}
}
if self.read_only_host:
data_source[self.key]['read_host'] = {
"host": self.read_only_host,
"user": settings.DATAZILLA_RO_DATABASE_USER,
"passwd": settings.DATAZILLA_RO_DATABASE_PASSWORD,
}
BaseHub.add_data_source(data_source)
# @@@ the datahub class should depend on self.type
return MySQL(self.key)
示例2: dhub
# 需要导入模块: from datasource.bases.BaseHub import BaseHub [as 别名]
# 或者: from datasource.bases.BaseHub.BaseHub import add_data_source [as 别名]
def dhub(self, procs_file_name):
"""
Return a configured ``DataHub`` using the given SQL procs file.
"""
master_host_config = {
"host": settings.DATABASES["default"]["HOST"],
"user": settings.DATABASES["default"]["USER"],
"passwd": settings.DATABASES["default"].get("PASSWORD") or "",
}
if "OPTIONS" in settings.DATABASES["default"]:
master_host_config.update(settings.DATABASES["default"]["OPTIONS"])
read_host_config = {
"host": settings.DATABASES["read_only"]["HOST"],
"user": settings.DATABASES["read_only"]["USER"],
"passwd": settings.DATABASES["read_only"].get("PASSWORD") or "",
}
if "OPTIONS" in settings.DATABASES["read_only"]:
read_host_config.update(settings.DATABASES["read_only"]["OPTIONS"])
data_source = {
self.key: {
"hub": "MySQL",
"master_host": master_host_config,
"read_host": read_host_config,
"require_host_type": True,
"default_db": self.name,
"procs": [os.path.join(SQL_PATH, procs_file_name), os.path.join(SQL_PATH, "generic.json")],
}
}
BaseHub.add_data_source(data_source)
return MySQL(self.key)
示例3: dhub
# 需要导入模块: from datasource.bases.BaseHub import BaseHub [as 别名]
# 或者: from datasource.bases.BaseHub.BaseHub import add_data_source [as 别名]
def dhub(self, procs_file_name):
"""
Return a configured ``DataHub`` using the given SQL procs file.
"""
master_host_config = {
"host": self.host,
"user": settings.TREEHERDER_DATABASE_USER,
"passwd": settings.TREEHERDER_DATABASE_PASSWORD,
}
if 'OPTIONS' in settings.DATABASES['default']:
master_host_config.update(settings.DATABASES['default']['OPTIONS'])
read_host_config = {
"host": self.read_only_host,
"user": settings.TREEHERDER_RO_DATABASE_USER,
"passwd": settings.TREEHERDER_RO_DATABASE_PASSWORD,
}
if 'OPTIONS' in settings.DATABASES['read_only']:
read_host_config.update(settings.DATABASES['read_only']['OPTIONS'])
data_source = {
self.key: {
# @@@ this should depend on self.type
# @@@ shouldn't have to specify this here and below
"hub": "MySQL",
"master_host": master_host_config,
"read_host": read_host_config,
"require_host_type": True,
"default_db": self.name,
"procs": [
os.path.join(SQL_PATH, procs_file_name),
os.path.join(SQL_PATH, "generic.json"),
],
}
}
BaseHub.add_data_source(data_source)
# @@@ the datahub class should depend on self.type
return MySQL(self.key)
示例4: dhub
# 需要导入模块: from datasource.bases.BaseHub import BaseHub [as 别名]
# 或者: from datasource.bases.BaseHub.BaseHub import add_data_source [as 别名]
def dhub(self, procs_file_name):
"""
Return a configured ``DataHub`` using the given SQL procs file.
"""
master_host_config = {
"host": settings.DATABASES['default']['HOST'],
"user": settings.DATABASES['default']['USER'],
"passwd": settings.DATABASES['default']['PASSWORD'],
}
if 'OPTIONS' in settings.DATABASES['default']:
master_host_config.update(settings.DATABASES['default']['OPTIONS'])
read_host_config = {
"host": settings.DATABASES['read_only']['HOST'],
"user": settings.DATABASES['read_only']['USER'],
"passwd": settings.DATABASES['read_only']['PASSWORD'],
}
if 'OPTIONS' in settings.DATABASES['read_only']:
read_host_config.update(settings.DATABASES['read_only']['OPTIONS'])
data_source = {
self.key: {
"hub": "MySQL",
"master_host": master_host_config,
"read_host": read_host_config,
"require_host_type": True,
"default_db": self.name,
"procs": [
os.path.join(SQL_PATH, procs_file_name),
os.path.join(SQL_PATH, "generic.json"),
],
}
}
BaseHub.add_data_source(data_source)
return MySQL(self.key)
示例5: __init__
# 需要导入模块: from datasource.bases.BaseHub import BaseHub [as 别名]
# 或者: from datasource.bases.BaseHub.BaseHub import add_data_source [as 别名]
def __init__(self):
procs_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
'sql', 'reference.json')
data_source = {
'reference': {
"hub": "MySQL",
"master_host": {
"host": settings.DATABASES['default']['HOST'],
"user": settings.DATABASES['default']['USER'],
"passwd": settings.DATABASES['default']['PASSWORD']
},
"default_db": settings.DATABASES['default']['NAME'],
"procs": [procs_path]
}
}
BaseHub.add_data_source(data_source)
self.dhub = DataHub.get("reference")
self.DEBUG = settings.DEBUG
# Support structures for building build platform SQL
self.build_platform_lookup = {}
self.build_where_filters = []
self.build_platform_placeholders = []
self.build_unique_platforms = []
# Support structures for building machine platform SQL
self.machine_platform_lookup = {}
self.machine_where_filters = []
self.machine_platform_placeholders = []
self.machine_unique_platforms = []
# Support structures for building job group SQL
self.job_group_lookup = {}
self.job_group_where_filters = []
self.job_group_placeholders = []
self.job_group_names_and_symbols = []
# Support structures for building job types SQL
self.job_type_lookup = {}
self.job_type_where_filters = []
self.job_type_placeholders = []
self.job_type_names_and_symbols = []
#Use this structure to map the job to the group id
self.job_type_to_group_lookup = {}
# Support structures for building product SQL
self.product_lookup = set()
self.product_where_in_list = []
self.product_placeholders = []
self.unique_products = []
# Support structures for building machine SQL
self.machine_name_lookup = set()
self.machine_where_in_list = []
self.machine_name_placeholders = []
self.machine_unique_names = []
self.machine_timestamp_update_placeholders = []
# Support structures for building option collection data structures
self.oc_hash_lookup = dict()
self.oc_where_in_list = []
self.oc_placeholders = []
self.oc_unique_collections = []
# Support structures for building option data structures
self.o_lookup = set()
self.o_placeholders = []
self.o_unique_options = []
self.o_where_in_list = []
# reference id lookup structure
self.id_lookup = {}