I've been meaning to write this one up for a while.. I've just installed the extension every time to avoid this one :)
Traceback (most recent call last):
File "peewee_bug.py", line 22, in <module>
MyModel.create_table()
File "/Users/alexlatchford/Code/peewee/peewee.py", line 3423, in create_table
db.create_table(cls)
File "/Users/alexlatchford/Code/peewee/peewee.py", line 2788, in create_table
return self.execute_sql(*qc.create_table(model_class, safe))
File "/Users/alexlatchford/Code/peewee/playhouse/postgres_ext.py", line 288, in execute_sql
self.commit()
File "/Users/alexlatchford/Code/peewee/peewee.py", line 2600, in __exit__
reraise(new_type, new_type(*exc_value.args), traceback)
File "/Users/alexlatchford/Code/peewee/playhouse/postgres_ext.py", line 279, in execute_sql
cursor = self.get_cursor()
File "/Users/alexlatchford/Code/peewee/playhouse/postgres_ext.py", line 266, in get_cursor
return self.get_conn().cursor(name=name)
File "/Users/alexlatchford/Code/peewee/peewee.py", line 2680, in get_conn
self.connect()
File "/Users/alexlatchford/Code/peewee/peewee.py", line 2667, in connect
self.__local.closed = False
File "/Users/alexlatchford/Code/peewee/peewee.py", line 2600, in __exit__
reraise(new_type, new_type(*exc_value.args), traceback)
File "/Users/alexlatchford/Code/peewee/peewee.py", line 2666, in connect
**self.connect_kwargs)
File "/Users/alexlatchford/Code/peewee/playhouse/postgres_ext.py", line 293, in _connect
register_hstore(conn, globally=True)
File "/Library/Python/2.7/site-packages/psycopg2/extras.py", line 775, in register_hstore
"hstore type not found in the database. "
peewee.ProgrammingError: hstore type not found in the database. please install it from your 'contrib/hstore.sql' file
I'm not really sure what to do here -- it's kind of on the database user to install the extension if they want to use it.
The point is I don't want to use it, it's forcing me to install it to use peewee.
Oh, I see.
I've added a register_hstore parameter to PostgresqlExtDatabase. The default is True to avoid breaking backwards compatibility.
Most helpful comment
I've added a
register_hstoreparameter toPostgresqlExtDatabase. The default isTrueto avoid breaking backwards compatibility.