AttributeError: 'list' object has no attribute '_meta' AttributeError: 'list' object has no attribute '_meta' flask flask

AttributeError: 'list' object has no attribute '_meta'


You passed in a list, not a single model here:

DATABASE.create_table([User], safe=True)

The Database.create_table() method only takes one model; the following would work:

DATABASE.create_table(User, safe=True)

You could also use the Database.create_tables() method (note the extra s at the end), which does require a sequence of models:

DATABASE.create_tables([User], safe=True)

Note that the Database.create_table() method (no trailing s) only creates the one table itself, and not any dependencies such as indexes or constraints. I suspect you simply made a typo and forgot the s.