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

Method drop_tables

tinydb/database.py:163–174  ·  view source on GitHub ↗

Drop all tables from the database. **CANNOT BE REVERSED!**

(self)

Source from the content-addressed store, hash-verified

161 return set(self.storage.read() or {})
162
163 def drop_tables(self) -> None:
164 """
165 Drop all tables from the database. **CANNOT BE REVERSED!**
166 """
167
168 # We drop all tables from this database by writing an empty dict
169 # to the storage thereby returning to the initial state with no tables.
170 self.storage.write({})
171
172 # After that we need to remember to empty the ``_tables`` dict, so we'll
173 # create new table instances when a table is accessed again.
174 self._tables.clear()
175
176 def drop_table(self, name: str) -> None:
177 """

Callers 15

dbFunction · 0.95
test_multiple_tablesFunction · 0.80
test_drop_tablesFunction · 0.80
test_allFunction · 0.80
test_insertFunction · 0.80
test_insert_idsFunction · 0.80
test_insert_with_doc_idFunction · 0.80
test_insert_multipleFunction · 0.80

Calls 2

clearMethod · 0.80
writeMethod · 0.45

Tested by 15

dbFunction · 0.76
test_multiple_tablesFunction · 0.64
test_drop_tablesFunction · 0.64
test_allFunction · 0.64
test_insertFunction · 0.64
test_insert_idsFunction · 0.64
test_insert_with_doc_idFunction · 0.64
test_insert_multipleFunction · 0.64