temporary_user_name
temporary_user_name

Reputation: 37118

Does db.create_all() check if the database exists?

I checked the docs but it didn't say anything much about it, weirdly.

If I call db.create_all(), does there need to be some sort of check as to whether the database already exists, lest it be overwritten?

Upvotes: 3

Views: 2489

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174748

The method only creates tables; so it is up to you to make sure the database is already created.

The database has to exist and if the table already exists, you'll receive an error from the database. It will not overwrite or delete tables.

Upvotes: 5

Related Questions