Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def explorer(self):
return PostgreSQLExplorer(self.namespace)
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,
)
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)
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(),
),
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,
)
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(),
),
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
)
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