Skip to main content

Accounts Snapshot

Table Metadata​

PropertyConfiguration
Natural Key(s)account_id, valid_from
Partition Field(s)valid_to (MONTH partition)
Clustered Field(s)account_id
Documentationdbt docs

Column Details​

NameDescriptionData TypeDomain ValuesRequired?Notes
account_idThe unique identifier of the account.STRINGYes
balanceThe number of units of XLM held by the account.FLOATYesThe accounts table only reports monetary balances for XLM. Any other asset class is reported in the trust_lines table.
buying_liabilitiesThe sum of all buy offers owned by this account for XLM only.FLOATYesThe accounts table only reports monetary balances for XLM. Any other asset class is reported in the trust_lines table. For buy offers, the account must hold the amount of asset to complete the transaction.
selling_liabilitiesThe sum of all sell offers owned by this account for XLM only.FLOATYesThe accounts table only reports monetary balances for XLM. Any other asset class is reported in the trust_lines table.
sequence_numberThe account's current sequence number. The sequence number controls operations applied to an account. Operations must submit a unique sequence number that is incremented by 1.INTEGERYesNatural Key. Required Field.
num_subentriesThe total number of ledger entries connected to this account. Ledger entries include: trustlines, offers, signers, and data entries.INTEGERYesEach entry on a ledger takes up space, which is expensive to store. Minimum balance is calculated by (2 + num_subentries - num_sponsoring + num_sponsored) * 0.5XLM.
inflation_destinationDeprecated: The account address to receive an inflation payment when disbursed.STRINGYesInflation was discontinued in 2019 by validator vote.
flagsDenotes enabling/disabling of certain asset issuer privileges.INTEGER
  • 0 - None, Default
  • 1 - Auth Required (all trustlines by default are untrusted and require manual trust established)
  • 2 - Auth Revocable (allows trustlines to be revoked if account no longer trusts asset)
  • 4 - Auth Immutable (all auth flags are read only when set)
  • 8 - Auth Clawback Enabled (asset can be clawed back from the user)
YesFlags can have values: 0=None, 1=Auth Required, 2=Auth Revocable, 4=Auth Immutable, 8=Auth Clawback Enabled.
home_domainURL of home domain linked to wallet.STRINGYes
master_weightThe weight of the master key, which is the private key for this account.INTEGERIntegers from 1 to 255YesIf master key = 0, account is locked.
threshold_lowThe sum of the weight of all signatures required for low threshold operations.INTEGERYesLow: Allow Trust, Set Trust Line Flags, Bump Sequence, Claim Claimable Balance.
threshold_mediumThe sum of the weight of all signatures required for medium threshold operations.INTEGERYesMedium: Everything Else.
threshold_highThe sum of the weight of all signatures required for high threshold operations.INTEGERYesHigh: Account Merge, Set Options.
last_modified_ledgerThe ledger sequence number when the ledger entry was last modified.INTEGERYesNatural Key. Cluster Field. Deletion does not count as modification.
ledger_entry_changeCode describing the ledger entry change type applied.INTEGER
  • 0 - Ledger Entry Created
  • 1 - Ledger Entry Updated
  • 2 - Ledger Entry Deleted
  • 3 - Ledger Entry State (value of the entry)
YesValues: 0=Created, 1=Updated (not valid for claimable balances), 2=Deleted.
deletedIndicates whether the ledger entry has been deleted.BOOLEANYesOnce deleted, cannot be recovered.
sponsorThe account address of the sponsor paying the reserves for this ledger entry.STRINGNoSponsors can be accounts, signers, claimable balances, trust lines.
num_sponsoredThe number of reserves sponsored for this account.INTEGERNoDefaults to 0.
num_sponsoringThe number of reserves sponsored by this account.INTEGERNoDefaults to 0.
sequence_ledgerThe unsigned 32-bit ledger number of the sequence number's age.INTEGERNoReflects the last time an account touched its sequence number.
sequence_timeTIMESTAMPNo
batch_idString representation of the run id for a given DAG in Airflow. Takes the form of "scheduled__<batch_end_date>-<dag_alias>". Batch ids are unique to the batch and help with monitoring and rerun capabilitiesstringYes
batch_run_dateThe start date for the batch interval.DATETIMEYesRepresents the interval of ledgers processed.
closed_atTimestamp in UTC when this ledger closed and committed.TIMESTAMPYesLedgers close ~every 5 seconds.
ledger_sequenceThe sequence number of this ledger.INTEGERYesCluster Field. Unique per ledger.
batch_insert_tsThe timestamp in UTC when a batch of records was inserted into the database.TIMESTAMPYesUseful for data engineering, not for ad hoc analysis.
airflow_start_tsThe timestamp when the airflow job starts.STRINGYesUsed to detect backfill jobs.
valid_fromThe timestamp when this snapshot row was first inserted and became effective.TIMESTAMPYesHelps track changes over time.
valid_toThe timestamp when this row is no longer valid.TIMESTAMPNoIf null, the setting is currently active.

Example Business Questions​

  1. Point-in-time query (as-of balance)
SELECT account_id, balance
FROM `crypto-stellar.snapshots.accounts_snapshot`
WHERE account_id = 'ACC123'
DATE('2025-01-15') BETWEEN DATE(valid_from) AND COALESCE(DATE(valid_to), '9999-12-31')
LIMIT 100
  1. Active snapshot (current records only)
SELECT account_id, balance, home_domain
FROM `crypto-stellar.snapshots.accounts_snapshot`
WHERE valid_to IS NULL
LIMIT 100
  1. Changes in February 2025 (partition pruning)
SELECT account_id, COUNT(*) AS num_changes
FROM `crypto-stellar.snapshots.accounts_snapshot`
WHERE DATE_TRUNC(valid_to, MONTH) = '2025-02-01'
GROUP BY account_id
LIMIT 100