Skip to main content

sql_flush

Return a list of the SQL statements used to flush the database.

def sql_flush(
style: Style,
connection: DatabaseWrapper,
reset_sequences: boolean = True,
allow_cascade: boolean = False
) - > list

Return a list of the SQL statements used to flush the database.

Parameters

NameTypeDescription
styleStyleA terminal color scheme object used to format the generated SQL output.
connectionDatabaseWrapperThe database connection object providing introspection and backend-specific SQL operations.
reset_sequencesboolean = TrueWhether to include SQL statements that reset primary key sequences to their initial values.
allow_cascadeboolean = FalseWhether to enable cascading deletes when clearing tables with foreign key dependencies.

Returns

TypeDescription
listA list of SQL strings required to clear all data from the database tables.