MCPcopy
hub / github.com/msiemens/tinydb / table

Method table

tinydb/database.py:111–133  ·  view source on GitHub ↗

Get access to a specific table. If the table hasn't been accessed yet, a new table instance will be created using the :attr:`~tinydb.database.TinyDB.table_class` class. Otherwise, the previously created table instance will be returned. All further options b

(self, name: str, **kwargs)

Source from the content-addressed store, hash-verified

109 return '<{} {}>'.format(type(self).__name__, ', '.join(args))
110
111 def table(self, name: str, **kwargs) -> Table:
112 """
113 Get access to a specific table.
114
115 If the table hasn&#x27;t been accessed yet, a new table instance will be
116 created using the :attr:`~tinydb.database.TinyDB.table_class` class.
117 Otherwise, the previously created table instance will be returned.
118
119 All further options besides the name are passed to the table class which
120 by default is :class:`~tinydb.table.Table`. Check its documentation
121 for further parameters you can pass.
122
123 :param name: The name of the table.
124 :param kwargs: Keyword arguments to pass to the table class constructor
125 """
126
127 if name in self._tables:
128 return self._tables[name]
129
130 table = self.table_class(self.storage, name, **kwargs)
131 self._tables[name] = table
132
133 return table
134
135 def tables(self) -> Set[str]:
136 """

Callers 15

__repr__Method · 0.95
__getattr__Method · 0.95
__len__Method · 0.95
__iter__Method · 0.95
test_gcFunction · 0.95
test_drop_tableFunction · 0.95
test_query_cacheFunction · 0.95
test_read_onceFunction · 0.80
test_tables_listFunction · 0.80
test_one_tableFunction · 0.80
test_multiple_tablesFunction · 0.80
test_cachingFunction · 0.80

Calls

no outgoing calls

Tested by 15

test_gcFunction · 0.76
test_drop_tableFunction · 0.76
test_query_cacheFunction · 0.76
test_read_onceFunction · 0.64
test_tables_listFunction · 0.64
test_one_tableFunction · 0.64
test_multiple_tablesFunction · 0.64
test_cachingFunction · 0.64
test_zero_cache_sizeFunction · 0.64
test_query_cache_sizeFunction · 0.64
test_lru_cacheFunction · 0.64