本文整理匯總了Python中redash.utils.configuration.ConfigurationContainer.from_json方法的典型用法代碼示例。如果您正苦於以下問題:Python ConfigurationContainer.from_json方法的具體用法?Python ConfigurationContainer.from_json怎麽用?Python ConfigurationContainer.from_json使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類redash.utils.configuration.ConfigurationContainer
的用法示例。
在下文中一共展示了ConfigurationContainer.from_json方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: python_value
# 需要導入模塊: from redash.utils.configuration import ConfigurationContainer [as 別名]
# 或者: from redash.utils.configuration.ConfigurationContainer import from_json [as 別名]
def python_value(self, value):
return ConfigurationContainer.from_json(value)
示例2: ModelFactory
# 需要導入模塊: from redash.utils.configuration import ConfigurationContainer [as 別名]
# 或者: from redash.utils.configuration.ConfigurationContainer import from_json [as 別名]
user_factory = ModelFactory(redash.models.User,
name='John Doe', email=Sequence('test{}@example.com'),
groups=[2],
org=1)
org_factory = ModelFactory(redash.models.Organization,
name=Sequence("Org {}"),
slug=Sequence("org{}.example.com"),
settings={})
data_source_factory = ModelFactory(redash.models.DataSource,
name=Sequence('Test {}'),
type='pg',
# If we don't use lambda here it will reuse the same options between tests:
options=lambda: ConfigurationContainer.from_json('{"dbname": "test"}'),
org=1)
dashboard_factory = ModelFactory(redash.models.Dashboard,
name='test', user=user_factory.create, layout='[]', org=1)
api_key_factory = ModelFactory(redash.models.ApiKey,
object=dashboard_factory.create)
query_factory = ModelFactory(redash.models.Query,
name='New Query',
description='',
query='SELECT 1',
user=user_factory.create,
is_archived=False,
schedule=None,
示例3: test_adds_data_source_to_default_group
# 需要導入模塊: from redash.utils.configuration import ConfigurationContainer [as 別名]
# 或者: from redash.utils.configuration.ConfigurationContainer import from_json [as 別名]
def test_adds_data_source_to_default_group(self):
data_source = DataSource.create_with_group(org=self.factory.org, name='test', options=ConfigurationContainer.from_json('{"dbname": "test"}'), type='pg')
self.assertIn(self.factory.org.default_group.id, data_source.groups)
示例4: ModelFactory
# 需要導入模塊: from redash.utils.configuration import ConfigurationContainer [as 別名]
# 或者: from redash.utils.configuration.ConfigurationContainer import from_json [as 別名]
user_factory = ModelFactory(redash.models.User,
name='John Doe', email=Sequence('test{}@example.com'),
groups=[2],
org=1)
org_factory = ModelFactory(redash.models.Organization,
name=Sequence("Org {}"),
slug=Sequence("org{}.example.com"),
settings={})
data_source_factory = ModelFactory(redash.models.DataSource,
name=Sequence('Test {}'),
type='pg',
options=ConfigurationContainer.from_json('{"dbname": "test"}'),
org=1)
dashboard_factory = ModelFactory(redash.models.Dashboard,
name='test', user=user_factory.create, layout='[]', org=1)
query_factory = ModelFactory(redash.models.Query,
name='New Query',
description='',
query='SELECT 1',
user=user_factory.create,
is_archived=False,
schedule=None,
data_source=data_source_factory.create,
org=1)
示例5: process_result_value
# 需要導入模塊: from redash.utils.configuration import ConfigurationContainer [as 別名]
# 或者: from redash.utils.configuration.ConfigurationContainer import from_json [as 別名]
def process_result_value(self, value, dialect):
return ConfigurationContainer.from_json(super(EncryptedConfiguration, self).process_result_value(value, dialect))