How to use the piicatcher.explorer.databases.RelDbExplorer.dispatch function in piicatcher

To help you get started, we’ve selected a few piicatcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tokern / piicatcher / tests / test_databases.py View on Github external
def test_mysql_dispatch(self):
        with mock.patch(
            "piicatcher.explorer.databases.MySQLExplorer.scan", autospec=True
        ) as mock_scan_method:
            with mock.patch(
                "piicatcher.explorer.databases.MySQLExplorer.get_tabular", autospec=True
            ) as mock_tabular_method:
                with mock.patch(
                    "piicatcher.explorer.explorer.tableprint", autospec=True
                ) as MockTablePrint:
                    RelDbExplorer.dispatch(
                        Namespace(
                            host="connection",
                            port=None,
                            list_all=None,
                            connection_type="mysql",
                            scan_type="deep",
                            catalog={"format": "ascii_table"},
                            user="user",
                            include_schema=(),
                            exclude_schema=(),
                            include_table=(),
                            exclude_table=(),
                            password="pass",
                        )
                    )
                    mock_scan_method.assert_called_once()
github tokern / piicatcher / tests / test_databases.py View on Github external
def test_postgres_dispatch(self):
        with mock.patch(
            "piicatcher.explorer.databases.PostgreSQLExplorer.scan", autospec=True
        ) as mock_scan_method:
            with mock.patch(
                "piicatcher.explorer.databases.PostgreSQLExplorer.get_tabular",
                autospec=True,
            ) as mock_tabular_method:
                with mock.patch(
                    "piicatcher.explorer.explorer.tableprint", autospec=True
                ) as MockTablePrint:
                    RelDbExplorer.dispatch(
                        Namespace(
                            host="connection",
                            port=None,
                            list_all=None,
                            connection_type="postgres",
                            database="public",
                            scan_type=None,
                            catalog={"format": "ascii_table"},
                            include_schema=(),
                            exclude_schema=(),
                            include_table=(),
                            exclude_table=(),
                            user="user",
                            password="pass",
                        )
                    )
github tokern / piicatcher / tests / test_databases.py View on Github external
def test_mysql_shallow_scan(self):
        with mock.patch(
            "piicatcher.explorer.databases.MySQLExplorer.shallow_scan", autospec=True
        ) as mock_shallow_scan_method:
            with mock.patch(
                "piicatcher.explorer.databases.MySQLExplorer.get_tabular", autospec=True
            ) as mock_tabular_method:
                with mock.patch(
                    "piicatcher.explorer.explorer.tableprint", autospec=True
                ) as MockTablePrint:
                    RelDbExplorer.dispatch(
                        Namespace(
                            host="connection",
                            port=None,
                            list_all=None,
                            connection_type="mysql",
                            catalog={"format": "ascii_table"},
                            include_schema=(),
                            exclude_schema=(),
                            include_table=(),
                            exclude_table=(),
                            user="user",
                            password="pass",
                            scan_type="shallow",
                        )
                    )
                    mock_shallow_scan_method.assert_called_once()
github tokern / piicatcher / piicatcher / explorer / databases.py View on Github external
exclude_table=exclude_table,
    )

    if output_format is not None or output is not None:
        logging.warning(
            "--output-format and --output is deprecated. "
            "Please use --catalog-format and --catalog-file"
        )

    if output_format is not None:
        ns.catalog["format"] = output_format

    if output is not None:
        ns.catalog["file"] = output

    RelDbExplorer.dispatch(ns)