blockdb. Use writes and subscriptions in Chaintable Notebooks; Functions can use permitted read interfaces. See the source for the full implementation.
Normal Tables
NormalTable(table_id)
table_id is the full table ID. Returns a Normal Table object.
filter_rows() conditions omit the WHERE keyword; use limit to restrict the number of rows. In scan(), quote the full table ID with backticks. The SDK does not fill in FROM from the table object. This is the BlockDB scan interface, whose supported SQL differs from the analytics engine.
Conditional writes
condition is (column_name, mode). IF_LARGER updates an existing record only when the new value is larger; IF_SMALLER updates only when it is smaller. Missing records are still inserted. The condition column cannot be the primary key, and all rows in a batch share one condition.
Every row in batch_write() needs the same field set. Success does not guarantee an immediately visible write. To check batch-write status, see Inspect asynchronous write jobs.
Block Event and Block State Tables
EventTable(table_id, block_id=None) / StateTable(table_id, block_id=None)
table_id identifies the table; block_id sets the read position. Event tables read by event ID, while state tables read a business ID’s state at that block. Without block_id, state tables read the object’s latest stored state, while event tables read the record at the highest block height for that event ID, without a consensus-height limit. When you specify a block, the server checks that the table’s consensus height covers it.
write(), the server fills in block fields. Every row in batch_write() must include block_id, block_height, and block_timestamp. A bundle number is not a block height.
Time Tables
TimeTable(table_id, time_at=None)
time_at sets the read time; omit it for the latest value. It accepts RFC3339 strings or Python datetime values. Times without a timezone are interpreted as UTC.
write() uses its timestamp argument, ignoring any row-level time_at. Use batch_write() for multiple timestamps, with each row containing only the three fixed fields.
The server groups time points into buckets and keeps the latest point in each bucket. Resolution changes with data age; see How tables work.
Blocks and subscriptions
start_at is a subscription event-time cursor accepting an RFC3339 string or Unix seconds, not a historical block height. Reconnection does not guarantee recovery of arbitrarily old events; combine subscriptions with backfills.
loose_align requires at least one trigger table. strict_align requires dependency consensus to reach the block being processed. See Subscribe to block events for a runnable example.
Filter expressions and types
Column and filter() build filters for Pipeline sources. Combine expressions with parenthesized & and |. Do not pass these expressions to filter_rows(), which expects a SQL condition string.
LogicalType provides type names, and restore_value(logical_type, raw) restores Python values according to metadata. For example, restore_value('UINT256', '1500000') retains a decimal string; use int() for computation. See Data types.