orcalib.index_query#
DefaultIndexQuery
#
Bases: TableQuery['DefaultIndexQuery']
A query on a (for now) single table.
This is used to build up a query and then execute it.
Parameters:
-
db_name
(str
) –The name of the database to query.
-
primary_table
(TableHandle
) –The primary table to query.
-
index
(IndexName
) –The name of the index to query.
-
index_query
(Any
) –The value to query the index for.
-
index_value
(ColumnName | None
, default:None
) –The name of the column to store the index value in. If None, the index value is not stored.
-
drop_exact_match
(bool
, default:False
) –Whether or not to drop exact matches.
-
exact_match_threshold
(float
, default:EXACT_MATCH_THRESHOLD
) –The threshold at which to drop exact matches
limit
#
Limits the number of rows returned by the query.
Parameters:
-
limit
(int
) –The maximum number of rows to return
Returns:
-
T
–query handle for chaining
Examples:
select
#
Selects the given columns from the table. If no columns are specified, all columns are selected.
Parameters:
-
columns
(ColumnName | ColumnHandle | tuple[ColumnName | ColumnHandle, Order]
, default:()
) –The columns to select
Returns:
-
T
–query handle for chaining
Examples:
fetch
#
df
#
Fetch the results of this query as a pandas DataFrame
Parameters:
-
limit
(int | None
, default:None
) –The maximum number of rows to return
-
explode
(bool
, default:False
) –Whether to explode the index_value column (if it exists) into multiple rows
Returns:
-
DataFrame
–The results of this query as a pandas DataFrame
VectorIndexQuery
#
Bases: TableQuery['VectorIndexQuery']
A query on a (for now) single table. This is used to build up a query and then execute it with .fetch()
Parameters:
-
db_name
(str
) –The name of the database to query.
-
primary_table
(TableHandle
) –The primary table to query.
-
columns
(list[ColumnName] | None
, default:None
) –The columns to select
-
filter
(OrcaExpr | None
, default:None
) –The filter to apply to the query.
-
order_by_columns
(OrderByColumns | None
, default:None
) –The columns to order by.
-
limit
(int | None
, default:None
) –The maximum number of rows to return.
-
default_order
(Order
, default:ASCENDING
) –The default order to use with “order_by” if no order is specified.
-
index
(IndexName
) –The name of the index to query.
-
index_query
(OrcaExpr
) –The value to query the index for.
-
drop_exact_match
(bool
, default:False
) –Whether to drop the exact match from the results.
-
exact_match_threshold
(float
, default:EXACT_MATCH_THRESHOLD
) –The minimum threshold for dropping the exact match.
-
curate_run_ids
(list[int] | None
, default:None
) –The run ids to use for curate.
-
curate_layer_name
(str | None
, default:None
) –The layer name to use for curate.
limit
#
Limits the number of rows returned by the query.
Parameters:
-
limit
(int
) –The maximum number of rows to return
Returns:
-
T
–query handle for chaining
Examples:
select
#
Selects the given columns from the table. If no columns are specified, all columns are selected.
Parameters:
-
columns
(ColumnName | ColumnHandle | tuple[ColumnName | ColumnHandle, Order]
, default:()
) –The columns to select
Returns:
-
T
–query handle for chaining
Examples:
df
#
fetch
#
Fetch the results of this query
Parameters:
-
limit
(int | None
, default:None
) –The maximum number of rows to return
Returns:
-
BatchedScanResult
–The batch of results for this query
track_with_curate
#
Enable curate tracking for the memories in this query
Parameters:
-
run_ids
(list[int]
) –The ids of the model runs to track these memory lookups under
-
layer_name
(str
) –The name of the model layer performing the lookup
Returns:
-
VectorIndexQuery
–The query handle for chaining