How to use the piicatcher.explorer.databases.PostgreSQLExplorer 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_sample_database.py View on Github external
def explorer(self):
        return PostgreSQLExplorer(self.namespace)
github tokern / piicatcher / tests / test_databases.py View on Github external
def setUp(self):
        self.explorer = PostgreSQLExplorer(
            Namespace(
                host="127.0.0.1",
                user="piiuser",
                password="p11secret",
                database="piidb",
                include_schema=(),
                exclude_schema=(),
                include_table=(),
                exclude_table=(),
                catalog=None,
            )
github tokern / piicatcher / tests / test_sample_database.py View on Github external
exclude_table=(),
            catalog=None,
        )

    @classmethod
    def get_connection(cls):
        return psycopg2.connect(
            host="127.0.0.1", user="piiuser", password="p11secret", database="piidb"
        )

    @property
    def explorer(self):
        return PostgreSQLExplorer(self.namespace)


class SmallSamplePGExplorer(PostgreSQLExplorer):
    @property
    def small_table_max(self):
        return 5


class SmallSamplePGExplorerTest(VanillaPGExplorerTest):
    @property
    def explorer(self):
        return SmallSamplePGExplorer(self.namespace)
github tokern / piicatcher / tests / test_databases.py View on Github external
def test_postgres(self):
        self.assertEqual(
            'select "c1","c2" from testSchema.t1 TABLESAMPLE BERNOULLI (10)',
            PostgreSQLExplorer._get_sample_query(
                self.schema,
                self.schema.get_children()[0],
                self.schema.get_children()[0].get_children(),
            ),
github tokern / piicatcher / tests / test_databases.py View on Github external
def setUp(self):
        self.explorer = PostgreSQLExplorer(
            Namespace(
                host="127.0.0.1",
                user="piiuser",
                password="p11secret",
                database="piidb",
                include_schema=(),
                exclude_schema=(),
                include_table=(),
                exclude_table=(),
                catalog=None,
            )
github tokern / piicatcher / tests / test_databases.py View on Github external
def test_postgres(self):
        self.assertEqual(
            'select "c1","c2" from testSchema.t1',
            PostgreSQLExplorer._get_select_query(
                self.schema,
                self.schema.get_children()[0],
                self.schema.get_children()[0].get_children(),
            ),
github tokern / piicatcher / piicatcher / explorer / databases.py View on Github external
def __init__(self, ns):
        super(PostgreSQLExplorer, self).__init__(ns)
        self._pg_database = (
            ns.database if "database" in vars(ns) and ns.database is not None else None
        )
github tokern / piicatcher / piicatcher / explorer / databases.py View on Github external
def factory(cls, ns):
        logging.debug("Relational Db Factory entered")
        explorer = None
        if ns.connection_type == "mysql":
            explorer = MySQLExplorer(ns)
        elif ns.connection_type == "postgres" or ns.connection_type == "redshift":
            explorer = PostgreSQLExplorer(ns)
        elif ns.connection_type == "oracle":
            explorer = OracleExplorer(ns)
        assert explorer is not None

        return explorer