MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / ERDTableView

Class ERDTableView

web/pgadmin/tools/erd/utils.py:19–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19class ERDTableView(BaseTableView, DataTypeReader):
20 def __init__(self):
21 super().__init__(cmd='erd')
22
23 @BaseTableView.check_precondition
24 def sql(self, conn_id=None, did=None, sid=None, data={}, with_drop=False):
25 return BaseTableView.get_sql(self, did, None, None, data, None,
26 add_not_exists_clause=True,
27 with_drop=with_drop)
28
29 @BaseTableView.check_precondition
30 def get_types(self, conn_id=None, did=None, sid=None):
31 condition = self.get_types_condition_sql(False)
32 return DataTypeReader.get_types(self, self.conn, condition, True)
33
34 @BaseTableView.check_precondition
35 def get_geometry_types(self, conn_id=None, did=None, sid=None):
36 return DataTypeReader.get_geometry_types(self, self.conn)
37
38 @BaseTableView.check_precondition
39 def fetch_all_tables(self, did=None, sid=None, scid=None):
40 all_tables = []
41 schemas = {'rows': []}
42 if scid is None:
43 status, schemas = get_schemas(self.conn, show_system_objects=False)
44 if not status:
45 return status, schemas
46 else:
47 schemas['rows'].append({'oid': scid})
48
49 for row in schemas['rows']:
50 status, res = \
51 BaseTableView.fetch_tables(self, sid, did, row['oid'],
52 with_serial_cols=True)
53 if not status:
54 return status, res
55
56 all_tables.extend(res.values())
57
58 return True, all_tables
59
60 @BaseTableView.check_precondition
61 def traverse_related_tables(self, did=None, sid=None, scid=None,
62 tid=None, related=None, maxdepth=0,
63 currdepth=0):
64
65 status, res = \
66 BaseTableView.fetch_tables(self, sid, did, scid, tid=tid,
67 with_serial_cols=True)
68
69 if not status:
70 return status, res
71
72 if related is None:
73 related = list()
74
75 related[tid] = res
76 # Max depth limit reached

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected