MCPcopy Create free account
hub / github.com/daniel2005d/mapXplore / _select

Method _select

database/PostgreSQL.py:69–89  ·  view source on GitHub ↗
(self, sentence: str, values=None, showColumns = False)

Source from the content-addressed store, hash-verified

67
68
69 def _select(self, sentence: str, values=None, showColumns = False):
70 rows = []
71 cur = self._get_cursor()
72 cur.execute(sentence, values)
73 results = cur.fetchall()
74 cur.close()
75 if showColumns:
76 column_names = [desc[0] for desc in cur.description]
77 for row in results:
78 row_with_column_names = {}
79 for idx, value in enumerate(row):
80 row_with_column_names[column_names[idx]] = value
81 rows.append(row_with_column_names)
82 else:
83 for row in results:
84 rows.append(row)
85
86 if len(rows)>0:
87 return rows
88
89 return None
90
91 def _check_exists_db(self, name:str) -> bool:
92 sentence = """

Callers 12

_check_exists_dbMethod · 0.95
_check_exists_columnMethod · 0.95
_get_columnsMethod · 0.95
get_databasesMethod · 0.95
execute_queryMethod · 0.95
get_tables_countMethod · 0.95
_value_existsMethod · 0.95
check_exists_tableMethod · 0.95
search_tablesMethod · 0.95
search_columnsMethod · 0.95
get_rowsMethod · 0.95

Calls 3

_get_cursorMethod · 0.95
closeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected