MCPcopy Index your code
hub / github.com/piccolo-orm/piccolo / get_table

Method get_table

piccolo/table_reflection.py:157–178  ·  view source on GitHub ↗

Returns the ``Table`` class if it exists. If the table is not present in ``TableStorage``, it will try to reflect it. :param tablename: The name of the table, schema name included. If the schema is public, it's not necessary. For example: "public.man

(self, tablename: str)

Source from the content-addressed store, hash-verified

155 self._schema_tables.clear()
156
157 async def get_table(self, tablename: str) -> Optional[type[Table]]:
158 """
159 Returns the ``Table`` class if it exists. If the table is not present
160 in ``TableStorage``, it will try to reflect it.
161
162 :param tablename:
163 The name of the table, schema name included. If the schema is
164 public, it's not necessary. For example: "public.manager" or
165 "manager", "test_schema.test_table".
166 :returns:
167 Table | None
168
169 """
170 table_class = self.tables.get(tablename)
171 if table_class is None:
172 tableNameDetail = self._get_schema_and_table_name(tablename)
173 await self.reflect(
174 schema_name=tableNameDetail.schema,
175 include=[tableNameDetail.name],
176 )
177 table_class = self.tables.get(tablename)
178 return table_class
179
180 async def _add_table(self, schema_name: str, table: type[Table]) -> None:
181 if issubclass(table, Table):

Callers 2

Calls 3

reflectMethod · 0.95
getMethod · 0.80

Tested by 2