def output(cls, ns, explorer): if ns.catalog["format"] == "ascii_table": headers = ["schema", "table", "column", "has_pii"] tableprint.table(explorer.get_tabular(ns.list_all), headers) elif ns.catalog["format"] == "json": FileStore.save_schemas(explorer) elif ns.catalog["format"] == "db": DbStore.save_schemas(explorer)
def output(cls, ns, explorer): if ns.output_format == "ascii_table": headers = ["schema", "table", "column", "has_pii"] tableprint.table(explorer.get_tabular(ns.list_all), headers) elif ns.output_format == "json": print(json.dumps(explorer.get_dict(), sort_keys=True, indent=2, cls=PiiTypeEncoder)) elif ns.output_format == "db": DbStore.save_schemas(explorer)
def setUpClass(cls): init_test(cls.sqlite_path) explorer = MockExplorer( Namespace(catalog=None, include_schema=(), exclude_schema=(), include_table=(), exclude_table=())) DbStore.save_schemas(explorer)
def test_setup_database(setup_explorer): DbStore.setup_database(catalog=catalog) with get_connection().cursor() as c: c.execute("select name from dbtables order by id") assert [("no_pii", ), ("partial_pii", ), ("full_pii", )] == list(c.fetchall())
def setUpClass(cls): init_test(cls.sqlite_path) explorer = MockExplorer(Namespace(catalog=None)) DbStore.save_schemas(explorer)