Skip to content

Commit 18418c0

Browse files
committed
schemaName rename cleanup
1 parent ca82b8c commit 18418c0

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

examples/advanced/file_upload.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ def ensure_table():
187187
sys.exit(1)
188188

189189
entity_set = table_info.get("entity_set_name")
190-
logical = table_info.get("entity_logical_name") or entity_set.rstrip("s")
191-
attr_prefix = logical.split('_',1)[0] if '_' in logical else logical
190+
table_schema_name = table_info.get("entity_schema_name") or entity_set.rstrip("s")
191+
attr_prefix = table_schema_name.split('_',1)[0] if '_' in table_schema_name else table_schema_name
192192
name_attr = f"{attr_prefix}_name"
193193
small_file_attr_schema = f"{attr_prefix}_SmallDocument" # second file attribute for small single-request demo
194194
small_file_attr_logical = f"{attr_prefix}_smalldocument" # expected logical name (lowercase)
@@ -258,13 +258,13 @@ def ensure_file_attribute_generic(schema_name: str, label: str, key_prefix: str)
258258
record_id = None
259259
try:
260260
payload = {name_attr: "File Sample Record"}
261-
log(f"client.create('{logical}', payload)")
262-
created_ids = backoff(lambda: client.create(logical, payload))
261+
log(f"client.create('{table_schema_name}', payload)")
262+
created_ids = backoff(lambda: client.create(table_schema_name, payload))
263263
if isinstance(created_ids, list) and created_ids:
264264
record_id = created_ids[0]
265265
else:
266266
raise RuntimeError("Unexpected create return; expected list[str] with at least one GUID")
267-
print({"record_created": True, "id": record_id, "logical": logical})
267+
print({"record_created": True, "id": record_id, "logical": table_schema_name})
268268
except Exception as e: # noqa: BLE001
269269
print({"record_created": False, "error": str(e)})
270270
sys.exit(1)
@@ -295,7 +295,7 @@ def get_dataset_info(file_path: Path):
295295
try:
296296
DATASET_FILE, small_file_size, src_hash = get_dataset_info(_GENERATED_TEST_FILE)
297297
backoff(lambda: client.upload_file(
298-
logical,
298+
table_schema_name,
299299
record_id,
300300
small_file_attr_logical,
301301
str(DATASET_FILE),
@@ -322,7 +322,7 @@ def get_dataset_info(file_path: Path):
322322
print("Small single-request upload demo - REPLACE with 8MB file:")
323323
replacement_file, replace_size_small, replace_hash_small = get_dataset_info(_GENERATED_TEST_FILE_8MB)
324324
backoff(lambda: client.upload_file(
325-
logical,
325+
table_schema_name,
326326
record_id,
327327
small_file_attr_logical,
328328
str(replacement_file),
@@ -350,7 +350,7 @@ def get_dataset_info(file_path: Path):
350350
try:
351351
DATASET_FILE, src_size_chunk, src_hash_chunk = get_dataset_info(_GENERATED_TEST_FILE)
352352
backoff(lambda: client.upload_file(
353-
logical,
353+
table_schema_name,
354354
record_id,
355355
chunk_file_attr_logical,
356356
str(DATASET_FILE),
@@ -376,7 +376,7 @@ def get_dataset_info(file_path: Path):
376376
print("Streaming chunk upload demo - REPLACE with 8MB file:")
377377
replacement_file, replace_size_chunk, replace_hash_chunk = get_dataset_info(_GENERATED_TEST_FILE_8MB)
378378
backoff(lambda: client.upload_file(
379-
logical,
379+
table_schema_name,
380380
record_id,
381381
chunk_file_attr_logical,
382382
str(replacement_file),
@@ -401,8 +401,8 @@ def get_dataset_info(file_path: Path):
401401
# --------------------------- Cleanup ---------------------------
402402
if cleanup_record and record_id:
403403
try:
404-
log(f"client.delete('{logical}', '{record_id}')")
405-
backoff(lambda: client.delete(logical, record_id))
404+
log(f"client.delete('{table_schema_name}', '{record_id}')")
405+
backoff(lambda: client.delete(table_schema_name, record_id))
406406
print({"record_deleted": True})
407407
except Exception as e: # noqa: BLE001
408408
print({"record_deleted": False, "error": str(e)})

0 commit comments

Comments
 (0)