Issue: execute_sql() got an unexpected keyword argument 'commit'
Author: jcrevits
State: closed
Created: 2018-03-02 02:52:07

Hi there, good job on the new version and I've been trying to upgrade one of our (older) systems that uses peewee. However I've been encountering the issue below. Does the traceback speak to you? This is with using postgres and `PooledPostgresqlExtDatabase`. Thank you and "hopefully" this is not on my side! (i.e. it's an actual bug)

```
Traceback (most recent call last):
  File "/home/travis/build/[secure]/[repo]/tests/controllers/test_proofread.py", line 17, in setUp
    self.parser = ParserModel.create(name='TestParser', code='tp', extension="xlsx")
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 5102, in create
    inst.save(force_insert=True)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/playhouse/signals.py", line 64, in save
    ret = super(Model, self).save(*args, **kwargs)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 5225, in save
    pk_from_cursor = self.insert(**field_dict).execute()
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1451, in inner
    return method(self, database, *args, **kwargs)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1522, in execute
    return self._execute(database)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 2154, in _execute
    return super(Insert, self)._execute(database)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1928, in _execute
    cursor = self.execute_returning(database)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1935, in execute_returning
    cursor = database.execute(self)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/playhouse/postgres_ext.py", line 426, in execute
    cursor = self.execute_sql(sql, params, commit=commit)
TypeError: execute_sql() got an unexpected keyword argument 'commit'Traceback (most recent call last):
  File "/home/travis/build/[secure]/nashville-parser/tests/controllers/test_proofread.py", line 17, in setUp
    self.parser = ParserModel.create(name='TestParser', code='tp', extension="xlsx")
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 5102, in create
    inst.save(force_insert=True)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/playhouse/signals.py", line 64, in save
    ret = super(Model, self).save(*args, **kwargs)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 5225, in save
    pk_from_cursor = self.insert(**field_dict).execute()
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1451, in inner
    return method(self, database, *args, **kwargs)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1522, in execute
    return self._execute(database)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 2154, in _execute
    return super(Insert, self)._execute(database)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1928, in _execute
    cursor = self.execute_returning(database)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/peewee.py", line 1935, in execute_returning
    cursor = database.execute(self)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/playhouse/postgres_ext.py", line 426, in execute
    cursor = self.execute_sql(sql, params, commit=commit)
TypeError: execute_sql() got an unexpected keyword argument 'commit'
```

I'm not sure I follow. In your database class have you overridden the `execute_sql` method?

If you look at the signature of `execute_sql` you'll see:

```python
    def execute_sql(self, sql, params=None, commit=SENTINEL):
```

I don't see `execute_sql()` being overridden by either `PostgresqlExtDatabase` or the `Pooled`-database classes, so I'm not sure what could be happening.

Mmmm, I didn't write the original code but it looks like your instincts were right - someone overwrote the `execute_sql` method for some reason. Sorry for making you check - will close this issue! 🙇