Skip to content

Commit f4afbef

Browse files
author
Samson Gebre
committed
fix: integration tests for SQL examples
1 parent aa896b8 commit f4afbef

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

examples/advanced/sql_examples.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def backoff(op, *, delays=(0, 2, 5, 10, 20, 20)):
8585
if last:
8686
if attempts:
8787
print(
88-
f" [WARN] Backoff exhausted after " f"{max(attempts - 1, 0)} retry(s); waited {total_delay}s total."
88+
f" [WARN] Backoff exhausted after {max(attempts - 1, 0)} retry(s); waited {total_delay}s total."
89+
f"\n [ERROR] {last}"
8990
)
9091
raise last
9192

@@ -174,15 +175,19 @@ def _run_examples(client):
174175
try:
175176
backoff(
176177
lambda: client.tables.create_lookup_field(
177-
referencing_table=child_table,
178+
referencing_table=child_table.lower(),
178179
lookup_field_name="new_TeamId",
179-
referenced_table=parent_table,
180+
referenced_table=parent_table.lower(),
180181
display_name="Team",
181182
)
182183
)
183184
print("[OK] Created lookup: new_TeamId on tasks -> teams")
184-
except Exception:
185-
print("[OK] Lookup already exists (or skipped)")
185+
except Exception as e:
186+
msg = str(e).lower()
187+
if "already exists" in msg or "duplicate" in msg:
188+
print("[OK] Lookup already exists (skipped)")
189+
else:
190+
raise
186191

187192
log_call(f"client.records.create('{parent_table}', [...])")
188193
teams = [
@@ -282,7 +287,7 @@ def _run_examples(client):
282287
rels = backoff(
283288
lambda: client.tables.list_table_relationships(
284289
child_table,
285-
select=["SchemaName", "ReferencedEntity", "ReferencingEntity"],
290+
select=["SchemaName"],
286291
)
287292
)
288293
print(f"[OK] Relationships on {child_table}: {len(rels)}")

0 commit comments

Comments
 (0)