@@ -8,7 +8,6 @@ use pyo3::{pyfunction, wrap_pyfunction};
88use sqlbuild_core:: constants:: RESOURCE_COSTS_TABLE_NAME ;
99use sqlbuild_core:: cost_command:: models:: CostCoverage ;
1010use sqlbuild_core:: cost_report:: models:: CostSummary ;
11- use sqlbuild_state:: consumption:: constants:: INTEGER_STATE_VALUE_TYPE ;
1211use sqlbuild_state:: events:: main:: resource_cost_observation_id:: resource_cost_observation_id;
1312use sqlbuild_state:: resource_costs:: constants:: {
1413 NULLABLE_RESOURCE_COST_COLUMNS , RESOURCE_COST_COLUMN_TYPES , TOTAL_RESOURCE_TYPE ,
@@ -19,11 +18,10 @@ use sqlbuild_state::resource_costs::models::{ResourceCostKey, RunCostAttempt};
1918use sqlbuild_state:: state_tables:: main:: values_insert_sql:: values_insert_sql;
2019
2120use crate :: bindings:: _helpers:: boundary:: python_calls:: { call_with, imported} ;
22- use crate :: bindings:: _helpers:: contracts:: state_literals:: render_state_sql_literal;
2321use crate :: bindings:: _helpers:: execution_history:: conversion:: { parsed_iso, utc} ;
2422use crate :: bindings:: _helpers:: native_host:: consumption_state:: {
25- Location , ROWS_PER_STATEMENT , execute, fixed_state_table_sql, literal , optional_text ,
26- state_table_name,
23+ Location , ROWS_PER_STATEMENT , execute, fixed_state_table_sql, integer_literal , literal ,
24+ optional_text , state_table_name,
2725} ;
2826use crate :: bindings:: _helpers:: records:: fields:: field as native_field;
2927
@@ -81,14 +79,6 @@ pub(crate) struct CostRunIdentity<'a> {
8179 pub ( crate ) completed_at : & ' a str ,
8280}
8381
84- fn integer ( py : Python < ' _ > , value : Option < i64 > ) -> PyResult < String > {
85- let value: Bound < ' _ , PyAny > = value. map_or_else (
86- || py. None ( ) . into_bound ( py) ,
87- |value| PyInt :: new ( py, value) . into_any ( ) ,
88- ) ;
89- render_state_sql_literal ( py, & value, INTEGER_STATE_VALUE_TYPE , None )
90- }
91-
9282fn table ( adapter : & Bound < ' _ , PyAny > , location : & Location ) -> PyResult < Option < String > > {
9383 let keywords = location. keywords ( adapter. py ( ) ) ;
9484 state_table_name (
@@ -167,21 +157,21 @@ fn observation_cells(
167157 literal( py, Some ( & observation_id) ) ?,
168158 literal( py, Some ( run. run_id) ) ?,
169159 literal( py, run. orchestration_run_id) ?,
170- integer ( py, Some ( attempt) ) ?,
160+ integer_literal ( py, Some ( attempt) ) ?,
171161 literal( py, Some ( row. resource_type) ) ?,
172162 literal( py, Some ( row. resource_name) ) ?,
173163 literal( py, Some ( row. warehouse_name) ) ?,
174164 literal( py, Some ( row. warehouse_size) ) ?,
175165 literal( py, row. warehouse_type) ?,
176- integer ( py, row. cluster_number) ?,
177- integer ( py, Some ( row. query_count) ) ?,
166+ integer_literal ( py, row. cluster_number) ?,
167+ integer_literal ( py, Some ( row. query_count) ) ?,
178168 literal( py, Some ( row. attributed_seconds) ) ?,
179- integer ( py, Some ( row. bytes_scanned) ) ?,
169+ integer_literal ( py, Some ( row. bytes_scanned) ) ?,
180170 literal( py, Some ( row. estimated_credits) ) ?,
181171 literal( py, row. estimated_usd. as_deref( ) ) ?,
182172 literal( py, Some ( & summary. status) ) ?,
183- integer ( py, Some ( summary. expected_statement_count) ) ?,
184- integer ( py, Some ( summary. observed_statement_count) ) ?,
173+ integer_literal ( py, Some ( summary. expected_statement_count) ) ?,
174+ integer_literal ( py, Some ( summary. observed_statement_count) ) ?,
185175 literal( py, Some ( & limitations) ) ?,
186176 literal( py, run. target_name) ?,
187177 literal( py, Some ( run. started_at) ) ?,
0 commit comments