mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
create_index now works with columns with spaces, closes #85
This commit is contained in:
parent
0c2451e069
commit
6f3cb2c106
2 changed files with 10 additions and 10 deletions
|
|
@ -625,12 +625,12 @@ class Table(Queryable):
|
|||
self.name.replace(" ", "_"), "_".join(columns)
|
||||
)
|
||||
sql = """
|
||||
CREATE {unique}INDEX {if_not_exists}{index_name}
|
||||
ON {table_name} ({columns});
|
||||
CREATE {unique}INDEX {if_not_exists}[{index_name}]
|
||||
ON [{table_name}] ({columns});
|
||||
""".format(
|
||||
index_name=index_name,
|
||||
table_name=self.name,
|
||||
columns=", ".join(columns),
|
||||
columns=", ".join("[{}]".format(c) for c in columns),
|
||||
unique="UNIQUE " if unique else "",
|
||||
if_not_exists="IF NOT EXISTS " if if_not_exists else "",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue