Skip to content

Commit

Permalink
Reverts 09a1f78 and instead ensures double quotes are escaped.
Browse files Browse the repository at this point in the history
Double quotes should be used for identifiers - it's a quirk that Sqlite
accepts them for strings as well, but in the event we encounter them we
should escape them to try to keep valid Python.

Refs #2909
  • Loading branch information
coleifer committed Aug 8, 2024
1 parent 7306521 commit 6d59dd6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion playhouse/reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def get_field_parameters(self):
if self.primary_key and not issubclass(self.field_class, AutoField):
params['primary_key'] = True
if self.default is not None:
params['constraints'] = '[SQL(\'DEFAULT %s\')]' % self.default
params['constraints'] = '[SQL("DEFAULT %s")]' % \
self.default.replace('"', '\\"')

# Handle ForeignKeyField-specific attributes.
if self.is_foreign_key():
Expand Down

0 comments on commit 6d59dd6

Please sign in to comment.