mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
Allow column names to be reserved words
This commit is contained in:
parent
6ad9037c96
commit
228d595f7d
2 changed files with 5 additions and 1 deletions
|
|
@ -318,7 +318,7 @@ class Table:
|
|||
""".format(
|
||||
upsert="OR REPLACE" if upsert else "",
|
||||
table=self.name,
|
||||
columns=", ".join(all_columns),
|
||||
columns=", ".join("[{}]".format(c) for c in all_columns),
|
||||
rows=", ".join(
|
||||
"""
|
||||
({placeholders})
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ def test_create_table(fresh_db):
|
|||
{"name": "Ravi", "age": 63},
|
||||
[{"name": "name", "type": "TEXT"}, {"name": "age", "type": "INTEGER"}],
|
||||
),
|
||||
(
|
||||
{"create": "Reserved word", "table": "Another"},
|
||||
[{"name": "create", "type": "TEXT"}, {"name": "table", "type": "TEXT"}],
|
||||
),
|
||||
),
|
||||
)
|
||||
def test_create_table_from_example(fresh_db, example, expected_columns):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue