convexity-sdk 0.21.0.dev394__tar.gz → 0.21.0.dev397__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/PKG-INFO +1 -1
  2. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/olap.py +29 -28
  3. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/create_csv_datasets.py +3 -2
  4. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/create_forecast_task.py +1 -1
  5. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/query_olap.py +2 -1
  6. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/.gitignore +0 -0
  7. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/README.md +0 -0
  8. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/__init__.py +0 -0
  9. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/client.py +0 -0
  10. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/config.py +0 -0
  11. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/exceptions.py +0 -0
  12. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/generated_transport.py +0 -0
  13. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/http.py +0 -0
  14. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/models/__init__.py +0 -0
  15. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/__init__.py +0 -0
  16. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_address_book_v2.py +0 -0
  17. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_analytics_v2.py +0 -0
  18. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_crm_customer_v2.py +0 -0
  19. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_datasets_v2.py +0 -0
  20. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_pricing_costing_v2.py +0 -0
  21. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_purchase_orders_v2.py +0 -0
  22. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_purchasing_item_sourcing_v2.py +0 -0
  23. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_purchasing_vendor_v2.py +0 -0
  24. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_purchasing_vendors_v2.py +0 -0
  25. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_replenishment_v2.py +0 -0
  26. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_sales_invoices_v2.py +0 -0
  27. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_sales_orders_v2.py +0 -0
  28. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_v2.py +0 -0
  29. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/_workspace_v2.py +0 -0
  30. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/address_book.py +0 -0
  31. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/analytics.py +0 -0
  32. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/api_keys.py +0 -0
  33. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/attributes.py +0 -0
  34. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/categories.py +0 -0
  35. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/classification.py +0 -0
  36. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/connections.py +0 -0
  37. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/cost_lists.py +0 -0
  38. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/crm.py +0 -0
  39. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/dashboards.py +0 -0
  40. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/datasets.py +0 -0
  41. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/email.py +0 -0
  42. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/environments.py +0 -0
  43. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/erp_config.py +0 -0
  44. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/imports.py +0 -0
  45. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/inventory.py +0 -0
  46. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/issues.py +0 -0
  47. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/logistics.py +0 -0
  48. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/organization_invitations.py +0 -0
  49. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/organizations.py +0 -0
  50. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/pricing.py +0 -0
  51. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/projects.py +0 -0
  52. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/purchase_order_documents.py +0 -0
  53. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/purchasing.py +0 -0
  54. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/rbac.py +0 -0
  55. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/replenishment.py +0 -0
  56. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/runs.py +0 -0
  57. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/sales.py +0 -0
  58. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/sales_channels.py +0 -0
  59. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/sales_invoice_documents.py +0 -0
  60. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/tasks.py +0 -0
  61. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/templates.py +0 -0
  62. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/usage.py +0 -0
  63. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/warehouses.py +0 -0
  64. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/worker_tasks.py +0 -0
  65. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/convexity_sdk/resources/workspace.py +0 -0
  66. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/pyproject.toml +0 -0
  67. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/.env.example +0 -0
  68. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/018_shipment_document.py +0 -0
  69. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/019_fulfillment_document.py +0 -0
  70. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/README.md +0 -0
  71. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/cancel_refresh_task.py +0 -0
  72. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/compare_api_key_scopes.py +0 -0
  73. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/create_dashboards.py +0 -0
  74. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/create_datasets.py +0 -0
  75. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/create_org_and_project.py +0 -0
  76. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/create_single_project_api_key.py +0 -0
  77. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/crm/001_check_crm_enabled.py +0 -0
  78. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/crm/002_enable_crm.py +0 -0
  79. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/crm/003_manage_customers.py +0 -0
  80. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/crm/004_disable_crm.py +0 -0
  81. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/crm/004_manage_sales_reps.py +0 -0
  82. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/getting_started.py +0 -0
  83. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/001_check_inventory_enabled.py +0 -0
  84. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/002_enable_inventory.py +0 -0
  85. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/003_manage_inventory_items.py +0 -0
  86. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/004_manage_inventory_stock.py +0 -0
  87. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/005_disable_inventory.py +0 -0
  88. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/006_manage_categories.py +0 -0
  89. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/007_manage_inventory_config.py +0 -0
  90. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/008_manage_cost_lists.py +0 -0
  91. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/009_list_location_items.py +0 -0
  92. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/010_list_item_warehouse_locations.py +0 -0
  93. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/inventory/011_assign_item_location.py +0 -0
  94. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/list_orgs_and_projects.py +0 -0
  95. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/manage_environments.py +0 -0
  96. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/manage_issues.py +0 -0
  97. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/project_usage.py +0 -0
  98. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/purchasing/001_check_purchasing_enabled.py +0 -0
  99. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/purchasing/002_enable_purchasing.py +0 -0
  100. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/purchasing/003_manage_vendors.py +0 -0
  101. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/purchasing/005_disable_purchasing.py +0 -0
  102. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/purchasing/006_open_purchase_order.py +0 -0
  103. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/purchasing/007_vendor_confirmation.py +0 -0
  104. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/purchasing/008_vendor_shipment.py +0 -0
  105. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/quickbook/001_check_quickbook_connection.py +0 -0
  106. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/quickbook/002_create_quickbook_datasets.py +0 -0
  107. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/rbac/001_manage_roles.py +0 -0
  108. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/rbac/002_manage_assignments.py +0 -0
  109. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/rbac/003_verify_rbac_access.py +0 -0
  110. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/001_check_sales_enabled.py +0 -0
  111. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/002_enable_sales.py +0 -0
  112. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/003_manage_sales_invoices.py +0 -0
  113. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/004_manage_sales_invoice_lifecycle.py +0 -0
  114. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/005_manage_sales_orders.py +0 -0
  115. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/006_disable_sales.py +0 -0
  116. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/007_manage_customers.py +0 -0
  117. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/007_price_list_sales_order.py +0 -0
  118. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/008_accept_sales_order.py +0 -0
  119. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/009_import_sales_order.py +0 -0
  120. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/010_read_order_item_progress.py +0 -0
  121. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/011_close_sales_order.py +0 -0
  122. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/012_cancel_sales_order.py +0 -0
  123. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/013_create_draft_invoice.py +0 -0
  124. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/014_sales_order_fulfillment_method.py +0 -0
  125. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/sales/015_import_invoices.py +0 -0
  126. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/shopify/001_check_shopify_connection.py +0 -0
  127. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/shopify/002_create_shopify_datasets.py +0 -0
  128. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/uci/001_setup.py +0 -0
  129. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/uci/002_seed_inventory_from_uci.py +0 -0
  130. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/uci/003_seed_sales_from_uci.py +0 -0
  131. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/uci/004_seed_purchasing_from_uci.py +0 -0
  132. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/uci/005_run_pipelines.py +0 -0
  133. {convexity_sdk-0.21.0.dev394 → convexity_sdk-0.21.0.dev397}/samples/workspace_files.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: convexity-sdk
3
- Version: 0.21.0.dev394
3
+ Version: 0.21.0.dev397
4
4
  Summary: Convexity Python SDK - programmatic access to the Convexity platform
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: convexity-api-client
@@ -3,7 +3,6 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from dataclasses import dataclass, field
6
- import json
7
6
  import time
8
7
  from typing import Any
9
8
 
@@ -17,15 +16,19 @@ from convexity_api_v2_client import Client as V2Client
17
16
  from convexity_api_v2_client.api.olap import get_olap_connection_v2 as _get_olap_connection
18
17
  from convexity_api_v2_client.api.olap import get_olap_table_schema_v2 as _get_olap_table_schema
19
18
  from convexity_api_v2_client.api.olap import list_olap_tables_v2 as _list_olap_tables
19
+ from convexity_api_v2_client.api.olap import run_olap_query_v2 as _run_olap_query
20
20
  from convexity_api_v2_client.api.olap import vacuum_olap_v2 as _vacuum_olap
21
21
  from convexity_api_v2_client.api.worker_tasks import get_worker_task_v2 as _get_worker_task
22
22
  from convexity_api_v2_client.models import (
23
23
  OlapConnectionResponseV2,
24
+ OlapQueryRequestV2,
25
+ OlapQueryResponseV2,
24
26
  OlapTableListV2,
25
27
  OlapTableSchemaV2,
26
28
  OlapVacuumTaskV2,
27
29
  WorkerTaskV2,
28
30
  )
31
+ from convexity_api_v2_client.models.olap_query_request_v2_params import OlapQueryRequestV2Params
29
32
 
30
33
  from ._v2 import parsed_or_raise
31
34
 
@@ -49,11 +52,9 @@ class OlapQueryRow:
49
52
  class OlapQueryResult:
50
53
  """Result of a server-side OLAP query.
51
54
 
52
- Defined locally in the SDK because the ``/olap/query`` endpoint is
53
- intentionally excluded from the generated client contract — reading the
54
- Iceberg tables directly with the vended S3 credentials is the recommended
55
- path. This convenience wrapper posts to the endpoint and parses the JSON
56
- response into a stable shape.
55
+ This compatibility shape is retained while the SDK uses the generated V2
56
+ operation. Reading Iceberg tables directly with vended S3 credentials is
57
+ still the recommended path for callers that need a local query engine.
57
58
  """
58
59
 
59
60
  columns: list[OlapQueryColumn] = field(default_factory=list)
@@ -119,37 +120,37 @@ class Olap:
119
120
  sql: str,
120
121
  *,
121
122
  params: dict[str, object] | None = None,
122
- max_rows: int = 10000,
123
+ max_rows: int = 9999,
123
124
  ) -> OlapQueryResult:
124
125
  """Run a read-only (SELECT/WITH) query against the project's Iceberg tables.
125
126
 
126
127
  Prefer reading the tables directly with the vended S3 credentials
127
128
  (``get_connection`` + ``list_tables_detailed`` + a local Iceberg engine
128
- such as DuckDB). This server-side query endpoint is a convenience
129
- fallback and is intentionally excluded from the generated client
130
- contract, so the request/response are handled here directly.
129
+ such as DuckDB). This convenience method retains its public API but
130
+ delegates to the native V2 R2 SQL operation.
131
131
  """
132
- body: dict[str, Any] = {"sql": sql, "maxRows": max_rows}
133
- if params is not None:
134
- body["params"] = dict(params)
135
- raw_body = json.dumps(body).encode("utf-8")
136
- response = self._client.get_httpx_client().post(
137
- "/v1/olap/query",
138
- params={"projectId": project_id},
139
- content=raw_body,
140
- headers={"Content-Type": "application/json"},
132
+ body = OlapQueryRequestV2(sql=sql, max_rows=max_rows)
133
+ if params:
134
+ request_params = OlapQueryRequestV2Params()
135
+ request_params.additional_properties = dict(params)
136
+ body.params = request_params
137
+ response = _run_olap_query.sync_detailed(
138
+ project_id,
139
+ client=self._v2_client,
140
+ body=body,
141
141
  )
142
142
  if response.status_code != 200:
143
- raise ValueError(f"OLAP query failed ({response.status_code}): {response.text}")
144
- data = response.json()
145
- columns = [OlapQueryColumn(name=col.get("name", ""), type_=col.get("type")) for col in data.get("columns", [])]
146
- rows = [OlapQueryRow(additional_properties=dict(row)) for row in data.get("rows", [])]
143
+ detail = response.parsed.detail if hasattr(response.parsed, "detail") else "OLAP query failed"
144
+ raise ValueError(f"OLAP query failed ({response.status_code}): {detail}")
145
+ result = response.parsed
146
+ if not isinstance(result, OlapQueryResponseV2):
147
+ raise ValueError(f"Unexpected OLAP query response: {result}")
147
148
  return OlapQueryResult(
148
- columns=columns,
149
- rows=rows,
150
- row_count=int(data.get("rowCount", len(rows))),
151
- truncated=bool(data.get("truncated", False)),
152
- elapsed_ms=int(data.get("elapsedMs", 0)),
149
+ columns=[OlapQueryColumn(name=column.name, type_=column.type_) for column in result.columns],
150
+ rows=[OlapQueryRow(additional_properties=dict(row.additional_properties)) for row in result.rows],
151
+ row_count=result.row_count,
152
+ truncated=result.truncated,
153
+ elapsed_ms=result.elapsed_ms,
153
154
  )
154
155
 
155
156
  def vacuum(self, project_id: str) -> OlapVacuumResponse:
@@ -160,6 +160,7 @@ print("\nQuerying CSV dataset via the OLAP endpoint …")
160
160
  # OLAP table names are derived from the dataset ID:
161
161
  # ds_<uuid_with_underscores>
162
162
  table_name = f"ds_{csv_dataset.id.replace('-', '_')}"
163
+ namespace = f"proj_{project.id.replace('-', '_')}"
163
164
 
164
165
 
165
166
  def _print_olap_result(response: object) -> None:
@@ -175,7 +176,7 @@ def _print_olap_result(response: object) -> None:
175
176
 
176
177
 
177
178
  # Query 1: Preview the CSV-backed table
178
- preview_sql = f'SELECT * FROM "{table_name}" LIMIT 5;'
179
+ preview_sql = f'SELECT * FROM "{namespace}"."{table_name}" LIMIT 5;'
179
180
  print(f"\n Query: {preview_sql}")
180
181
  _print_olap_result(client.olap.query(project.id, preview_sql))
181
182
 
@@ -186,7 +187,7 @@ SELECT
186
187
  COUNT(*) AS product_count,
187
188
  ROUND(SUM(revenue), 2) AS total_revenue,
188
189
  ROUND(AVG(unit_price), 2) AS avg_price
189
- FROM "{table_name}"
190
+ FROM "{namespace}"."{table_name}"
190
191
  GROUP BY category
191
192
  ORDER BY total_revenue DESC;
192
193
  """
@@ -126,7 +126,7 @@ MONTHLY_DEMAND_TABLE = "__MONTHLY_DEMAND_TABLE__"
126
126
 
127
127
  response = client.olap.query(
128
128
  project_id,
129
- f'SELECT month, SUM(demand) AS total_demand FROM "{MONTHLY_DEMAND_TABLE}" GROUP BY month ORDER BY month ASC',
129
+ f'SELECT month, SUM(demand) AS total_demand FROM "proj_{project_id.replace("-", "_")}"."{MONTHLY_DEMAND_TABLE}" GROUP BY month ORDER BY month ASC',
130
130
  )
131
131
  client.close()
132
132
 
@@ -61,7 +61,8 @@ if not table_names:
61
61
 
62
62
  # ── Step 4: Run an example query ────────────────────────────────────────
63
63
  first_table = table_names[0]
64
- sql = f'SELECT * FROM "{first_table}" LIMIT 5;'
64
+ namespace = f"proj_{project.id.replace('-', '_')}"
65
+ sql = f'SELECT * FROM "{namespace}"."{first_table}" LIMIT 5;'
65
66
 
66
67
  print(f"\nPreview of '{first_table}' (first 5 rows):")
67
68
  print(f" SQL: {sql}\n")