Skip to content

Commit eee04db

Browse files
committed
fix insert test - was fetching wrong constraint name from db
1 parent daf21f1 commit eee04db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/table/test_insert.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,18 @@ def test_target_string(self):
232232
"""
233233
Band = self.Band
234234

235-
constraint_name = Band.raw(
236-
"""
235+
constraint_name = [
236+
i["constraint_name"]
237+
for i in Band.raw(
238+
"""
237239
SELECT constraint_name
238240
FROM information_schema.constraint_column_usage
239241
WHERE column_name = 'name'
240242
AND table_name = 'band';
241243
"""
242-
).run_sync()[0]["constraint_name"]
244+
).run_sync()
245+
if i["constraint_name"].endswith("_key")
246+
][0]
243247

244248
query = Band.insert(Band(name=self.band.name)).on_conflict(
245249
target=constraint_name,

0 commit comments

Comments
 (0)