Can't create a table called `model` in PostgreSQL
In the meantime you can work around by naming your class something else and
specifying db_table='model', but I will get this fixed asap.

On Aug 10, 2016 2:09 PM, "Brett Naul" notifications@github.com wrote:

> Was fine on 2.8.1 but has broken since upgrading to 2.8.2. Example:
> 
> import peewee as pw
> 
> db = pw.PostgresqlDatabase(autocommit=True, autorollback=True,
>                            database='postgres', host=None, password=None,
>                            port=5432)
> 
> class NotModel(pw.Model):
>     name = pw.CharField()
>     class Meta:
>         database = db
> 
> class Model(pw.Model):
>     name = pw.CharField()
>     class Meta:
>         database = db
> 
> if **name** == "**main**":
>     db.create_table(NotModel, safe=True)
>     db.create_table(Model, safe=True)
> 
> notmodel is created but creating model fails:
> 
> AttributeError                            Traceback (most recent call last)
> /Users/brettnaul/Dropbox/Documents/cesium_web/cesium_app/models.py in <module>()
>      23 if **name** == "**main**":
>      24     db.create_table(NotModel, safe=True)
> ---> 25     db.create_table(Model, safe=True)
>      26
> 
> /Users/brettnaul/miniconda3/envs/cesium/lib/python3.5/site-packages/peewee.py in create_table(self, model_class, safe)
>    3753     def create_table(self, model_class, safe=False):
>    3754         qc = self.compiler()
> -> 3755         return self.execute_sql(*qc.create_table(model_class, safe))
>    3756
>    3757     def create_tables(self, models, safe=False):
> 
> /Users/brettnaul/miniconda3/envs/cesium/lib/python3.5/site-packages/peewee.py in inner(self, _args, *_kwargs)
>    2071         def inner(self, _args, *_kwargs):
>    2072             fn = getattr(self, function_name)
> -> 2073             return self.parse_node(fn(_args, *_kwargs))
>    2074         return inner
>    2075
> 
> /Users/brettnaul/miniconda3/envs/cesium/lib/python3.5/site-packages/peewee.py in _create_table(self, model_class, safe)
>    2090     def _create_table(self, model_class, safe=False):
>    2091         statement = 'CREATE TABLE IF NOT EXISTS' if safe else 'CREATE TABLE'
> -> 2092         meta = model_class._meta
>    2093
>    2094         columns, constraints = [], []
> 
> AttributeError: type object 'Model' has no attribute '_meta'
> 
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> https://github.com/coleifer/peewee/issues/1035, or mute the thread
> https://github.com/notifications/unsubscribe-auth/AAHUplWJ5-QGVfxP3ixcxIrMUlbvNyEBks5qeiH7gaJpZM4JheYy
> .
 Great, thanks! Any chance we can get a quicker bugfix release this time around? 😬 
 Yeah let me see if I can round up a couple other small bugs.

Was fine on `2.8.1` but has broken since upgrading to `2.8.2`. Example:

```
import peewee as pw

db = pw.PostgresqlDatabase(autocommit=True, autorollback=True,
                           database='postgres', host=None, password=None,
                           port=5432)

class NotModel(pw.Model):
    name = pw.CharField()
    class Meta:
        database = db


class Model(pw.Model):
    name = pw.CharField()
    class Meta:
        database = db


if __name__ == "__main__":
    db.create_table(NotModel, safe=True)
    db.create_table(Model, safe=True)
```

`notmodel` is created but creating `model` fails:

```
AttributeError                            Traceback (most recent call last)
/Users/brettnaul/Dropbox/Documents/cesium_web/cesium_app/models.py in <module>()
     23 if __name__ == "__main__":
     24     db.create_table(NotModel, safe=True)
---> 25     db.create_table(Model, safe=True)
     26

/Users/brettnaul/miniconda3/envs/cesium/lib/python3.5/site-packages/peewee.py in create_table(self, model_class, safe)
   3753     def create_table(self, model_class, safe=False):
   3754         qc = self.compiler()
-> 3755         return self.execute_sql(*qc.create_table(model_class, safe))
   3756
   3757     def create_tables(self, models, safe=False):

/Users/brettnaul/miniconda3/envs/cesium/lib/python3.5/site-packages/peewee.py in inner(self, *args, **kwargs)
   2071         def inner(self, *args, **kwargs):
   2072             fn = getattr(self, function_name)
-> 2073             return self.parse_node(fn(*args, **kwargs))
   2074         return inner
   2075

/Users/brettnaul/miniconda3/envs/cesium/lib/python3.5/site-packages/peewee.py in _create_table(self, model_class, safe)
   2090     def _create_table(self, model_class, safe=False):
   2091         statement = 'CREATE TABLE IF NOT EXISTS' if safe else 'CREATE TABLE'
-> 2092         meta = model_class._meta
   2093
   2094         columns, constraints = [], []

AttributeError: type object 'Model' has no attribute '_meta'
```
