MCPcopy Index your code
hub / github.com/PokeAPI/pokeapi / clear_table

Function clear_table

data/v2/build.py:90–106  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

88
89
90def clear_table(model):
91 table_name = model._meta.db_table
92 model.objects.all().delete()
93 print("building " + table_name)
94 # Reset DB auto increments to start at 1
95 if DB_VENDOR == "sqlite":
96 DB_CURSOR.execute(
97 "DELETE FROM sqlite_sequence WHERE name = " + "'" + table_name + "'"
98 )
99 else:
100 DB_CURSOR.execute(
101 "SELECT setval(pg_get_serial_sequence("
102 + "'"
103 + table_name
104 + "'"
105 + ",'id'), 1, false);"
106 )
107
108
109def build_generic(model_classes, file_name, csv_record_to_objects):

Callers 1

build_genericFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected