当前位置: 首页>>代码示例>>Python>>正文


Python models.SqlaTable类代码示例

本文整理汇总了Python中superset.connectors.sqla.models.SqlaTable的典型用法代码示例。如果您正苦于以下问题:Python SqlaTable类的具体用法?Python SqlaTable怎么用?Python SqlaTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SqlaTable类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_import_table_override_sync

    def test_import_table_override_sync(self):
        table, dict_table = self.create_table(
            'table_override', id=ID_PREFIX + 3,
            cols_names=['col1'],
            metric_names=['m1'])
        imported_table = SqlaTable.import_from_dict(db.session, dict_table)
        db.session.commit()
        table_over, dict_table_over = self.create_table(
            'table_override', id=ID_PREFIX + 3,
            cols_names=['new_col1', 'col2', 'col3'],
            metric_names=['new_metric1'])
        imported_over_table = SqlaTable.import_from_dict(
            session=db.session,
            dict_rep=dict_table_over,
            sync=['metrics', 'columns'])
        db.session.commit()

        imported_over = self.get_table(imported_over_table.id)
        self.assertEquals(imported_table.id, imported_over.id)
        expected_table, _ = self.create_table(
            'table_override', id=ID_PREFIX + 3,
            metric_names=['new_metric1'],
            cols_names=['new_col1', 'col2', 'col3'])
        self.assert_table_equals(expected_table, imported_over)
        self.yaml_compare(
            expected_table.export_to_dict(),
            imported_over.export_to_dict())
开发者ID:neuroradiology,项目名称:caravel,代码行数:27,代码来源:dict_import_export_tests.py

示例2: test_import_table_override_idential

    def test_import_table_override_idential(self):
        table = self.create_table(
            'copy_cat', id=10004, cols_names=['new_col1', 'col2', 'col3'],
            metric_names=['new_metric1'])
        imported_id = SqlaTable.import_obj(table, import_time=1993)

        copy_table = self.create_table(
            'copy_cat', id=10004, cols_names=['new_col1', 'col2', 'col3'],
            metric_names=['new_metric1'])
        imported_id_copy = SqlaTable.import_obj(
            copy_table, import_time=1994)

        self.assertEquals(imported_id, imported_id_copy)
        self.assert_table_equals(copy_table, self.get_table(imported_id))
开发者ID:avsolatorio,项目名称:caravel,代码行数:14,代码来源:import_export_tests.py

示例3: test_import_table_no_metadata

 def test_import_table_no_metadata(self):
     table, dict_table = self.create_table('pure_table', id=ID_PREFIX + 1)
     new_table = SqlaTable.import_from_dict(db.session, dict_table)
     db.session.commit()
     imported_id = new_table.id
     imported = self.get_table(imported_id)
     self.assert_table_equals(table, imported)
     self.yaml_compare(table.export_to_dict(), imported.export_to_dict())
开发者ID:neuroradiology,项目名称:caravel,代码行数:8,代码来源:dict_import_export_tests.py

示例4: test_import_table_2_col_2_met

    def test_import_table_2_col_2_met(self):
        table = self.create_table(
            'table_2_col_2_met', id=10003, cols_names=['c1', 'c2'],
            metric_names=['m1', 'm2'])
        imported_id = SqlaTable.import_obj(table, import_time=1991)

        imported = self.get_table(imported_id)
        self.assert_table_equals(table, imported)
开发者ID:avsolatorio,项目名称:caravel,代码行数:8,代码来源:import_export_tests.py

示例5: test_import_table_override_identical

 def test_import_table_override_identical(self):
     table, dict_table = self.create_table(
         'copy_cat', id=ID_PREFIX + 4,
         cols_names=['new_col1', 'col2', 'col3'],
         metric_names=['new_metric1'])
     imported_table = SqlaTable.import_from_dict(db.session, dict_table)
     db.session.commit()
     copy_table, dict_copy_table = self.create_table(
         'copy_cat', id=ID_PREFIX + 4,
         cols_names=['new_col1', 'col2', 'col3'],
         metric_names=['new_metric1'])
     imported_copy_table = SqlaTable.import_from_dict(db.session,
                                                      dict_copy_table)
     db.session.commit()
     self.assertEquals(imported_table.id, imported_copy_table.id)
     self.assert_table_equals(copy_table, self.get_table(imported_table.id))
     self.yaml_compare(imported_copy_table.export_to_dict(),
                       imported_table.export_to_dict())
开发者ID:neuroradiology,项目名称:caravel,代码行数:18,代码来源:dict_import_export_tests.py

示例6: test_import_table_2_col_2_met

 def test_import_table_2_col_2_met(self):
     table, dict_table = self.create_table(
         'table_2_col_2_met', id=ID_PREFIX + 3, cols_names=['c1', 'c2'],
         metric_names=['m1', 'm2'])
     imported_table = SqlaTable.import_from_dict(db.session, dict_table)
     db.session.commit()
     imported = self.get_table(imported_table.id)
     self.assert_table_equals(table, imported)
     self.yaml_compare(table.export_to_dict(), imported.export_to_dict())
开发者ID:neuroradiology,项目名称:caravel,代码行数:9,代码来源:dict_import_export_tests.py

示例7: test_import_table_override

    def test_import_table_override(self):
        table = self.create_table(
            'table_override', id=10003, cols_names=['col1'],
            metric_names=['m1'])
        imported_id = SqlaTable.import_obj(table, import_time=1991)

        table_over = self.create_table(
            'table_override', id=10003, cols_names=['new_col1', 'col2', 'col3'],
            metric_names=['new_metric1'])
        imported_over_id = SqlaTable.import_obj(
            table_over, import_time=1992)

        imported_over = self.get_table(imported_over_id)
        self.assertEquals(imported_id, imported_over.id)
        expected_table = self.create_table(
            'table_override', id=10003, metric_names=['new_metric1', 'm1'],
            cols_names=['col1', 'new_col1', 'col2', 'col3'])
        self.assert_table_equals(expected_table, imported_over)
开发者ID:avsolatorio,项目名称:caravel,代码行数:18,代码来源:import_export_tests.py

示例8: test_import_table_1_col_1_met

 def test_import_table_1_col_1_met(self):
     table = self.create_table(
         'table_1_col_1_met', id=10002,
         cols_names=["col1"], metric_names=["metric1"])
     imported_id = SqlaTable.import_obj(table, import_time=1990)
     imported = self.get_table(imported_id)
     self.assert_table_equals(table, imported)
     self.assertEquals(
         {'remote_id': 10002, 'import_time': 1990, 'database_name': 'main'},
         json.loads(imported.params))
开发者ID:avsolatorio,项目名称:caravel,代码行数:10,代码来源:import_export_tests.py

示例9: test_import_table_1_col_1_met

 def test_import_table_1_col_1_met(self):
     table, dict_table = self.create_table(
         'table_1_col_1_met', id=ID_PREFIX + 2,
         cols_names=['col1'], metric_names=['metric1'])
     imported_table = SqlaTable.import_from_dict(db.session, dict_table)
     db.session.commit()
     imported = self.get_table(imported_table.id)
     self.assert_table_equals(table, imported)
     self.assertEquals(
         {DBREF: ID_PREFIX + 2, 'database_name': 'main'},
         json.loads(imported.params))
     self.yaml_compare(table.export_to_dict(), imported.export_to_dict())
开发者ID:neuroradiology,项目名称:caravel,代码行数:12,代码来源:dict_import_export_tests.py

示例10: test_comments_in_sqlatable_query

 def test_comments_in_sqlatable_query(self):
     clean_query = "SELECT '/* val 1 */' as c1, '-- val 2' as c2 FROM tbl"
     commented_query = '/* comment 1 */' + clean_query + '-- comment 2'
     table = SqlaTable(sql=commented_query)
     rendered_query = text_type(table.get_from_clause())
     self.assertEqual(clean_query, rendered_query)
开发者ID:zhangxi123051,项目名称:incubator-superset,代码行数:6,代码来源:core_tests.py

示例11: test_import_table_no_metadata

 def test_import_table_no_metadata(self):
     table = self.create_table('pure_table', id=10001)
     imported_id = SqlaTable.import_obj(table, import_time=1989)
     imported = self.get_table(imported_id)
     self.assert_table_equals(table, imported)
开发者ID:avsolatorio,项目名称:caravel,代码行数:5,代码来源:import_export_tests.py


注:本文中的superset.connectors.sqla.models.SqlaTable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。