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


Python ConfigurationContainer.from_json方法代碼示例

本文整理匯總了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)
開發者ID:Drunkar,項目名稱:redash,代碼行數:4,代碼來源:models.py

示例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,
開發者ID:5t111111,項目名稱:redash,代碼行數:32,代碼來源:factories.py

示例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)
開發者ID:5t111111,項目名稱:redash,代碼行數:5,代碼來源:test_data_sources.py

示例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)
開發者ID:babybits,項目名稱:redash,代碼行數:31,代碼來源:factories.py

示例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))
開發者ID:ariarijp,項目名稱:redash,代碼行數:4,代碼來源:types.py


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