> ## Documentation Index
> Fetch the complete documentation index at: https://developers.stellar.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Accounts Snapshot

> Reference documentation for the Accounts Snapshot table in Hubble's Silver data dictionary.

## Table Metadata

| Property | Configuration |
| - | - |
| Natural Key(s) | account\_id, valid\_from |
| Partition Field(s) | valid\_to (MONTH partition) |
| Clustered Field(s) | account\_id |
| Documentation | [dbt docs](http://www.stellar-dbt-docs.com/#!/model/model.stellar_dbt_public.accounts_snapshot) |

## Column Details

| Name | Description | Data Type | Domain Values | Required? | Notes |
| - | - | - | - | - | - |
| account\_id | The unique identifier of the account. | STRING | | Yes | |
| balance | The number of units of XLM held by the account. | FLOAT | | Yes | The `accounts` table only reports monetary balances for XLM. Any other asset class is reported in the `trust_lines` table. |
| buying\_liabilities | The sum of all buy offers owned by this account for XLM only. | FLOAT | | Yes | The `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\_liabilities | The sum of all sell offers owned by this account for XLM only. | FLOAT | | Yes | The `accounts` table only reports monetary balances for XLM. Any other asset class is reported in the `trust_lines` table. |
| sequence\_number | The 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. | INTEGER | | Yes | Natural Key. Required Field. |
| num\_subentries | The account's subentry count, a weighted total rather than a row count. Subentries are the account's trustlines, offers, signers, and data entries. Each offer, signer, data entry, or ordinary trustline adds 1. A pool share trustline adds 2 and therefore requires two base reserves (see [CAP-38](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0038.md)). | INTEGER | | Yes | Each entry on a ledger takes up space, which is expensive to store. Minimum balance is calculated by (2 + num\_subentries + num\_sponsoring - num\_sponsored) \* base\_reserve, currently 0.5 XLM. |
| inflation\_destination | Deprecated: The account address to receive an inflation payment when disbursed. | STRING | | Yes | Inflation was discontinued in 2019 by validator vote. |
| flags | Denotes enabling/disabling of certain asset issuer privileges. | INTEGER | <ul><li>0 - None, Default</li><li>1 - Auth Required (all trustlines by default are untrusted and require manual trust established)</li><li>2 - Auth Revocable (allows trustlines to be revoked if account no longer trusts asset)</li><li>4 - Auth Immutable (all auth flags are read only when set)</li><li>8 - Auth Clawback Enabled (asset can be clawed back from the user)</li></ul> | Yes | Flags can have values: 0=None, 1=Auth Required, 2=Auth Revocable, 4=Auth Immutable, 8=Auth Clawback Enabled. |
| home\_domain | URL of home domain linked to wallet. | STRING | | Yes | |
| master\_weight | The weight of the master key, which is the private key for this account. | INTEGER | Integers from 0 to 255 | Yes | If master key = 0, account is locked. |
| threshold\_low | The sum of the weight of all signatures required for low threshold operations. | INTEGER | | Yes | Low: Allow Trust, Set Trust Line Flags, Bump Sequence, Claim Claimable Balance. |
| threshold\_medium | The sum of the weight of all signatures required for medium threshold operations. | INTEGER | | Yes | Medium: Everything Else. |
| threshold\_high | The sum of the weight of all signatures required for high threshold operations. | INTEGER | | Yes | High: Account Merge, Set Options. |
| last\_modified\_ledger | The ledger sequence number when the ledger entry was last modified. | INTEGER | | Yes | Natural Key. Cluster Field. Deletion does not count as modification. |
| ledger\_entry\_change | Code describing the ledger entry change type applied. | INTEGER | <ul><li>0 - Ledger Entry Created</li><li>1 - Ledger Entry Updated</li><li>2 - Ledger Entry Deleted</li><li>3 - Ledger Entry State (value of the entry)</li></ul> | Yes | Values: 0=Created, 1=Updated (not valid for claimable balances), 2=Deleted. |
| deleted | Indicates whether the ledger entry has been deleted. | BOOLEAN | | Yes | Once deleted, cannot be recovered. |
| sponsor | The account address of the sponsor paying the reserves for this ledger entry. | STRING | | No | Sponsors can be accounts, signers, claimable balances, trust lines. |
| num\_sponsored | The number of reserves sponsored for this account. | INTEGER | | No | Defaults to 0. |
| num\_sponsoring | The number of reserves sponsored by this account. | INTEGER | | No | Defaults to 0. |
| sequence\_ledger | The unsigned 32-bit ledger number of the sequence number's age. | INTEGER | | No | Reflects the last time an account touched its sequence number. |
| sequence\_time | | TIMESTAMP | | No | |
| batch\_id | String 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 capabilities | string | | Yes | |
| batch\_run\_date | The start date for the batch interval. | DATETIME | | Yes | Represents the interval of ledgers processed. |
| closed\_at | Timestamp in UTC when this ledger closed and committed. | TIMESTAMP | | Yes | Ledgers close \~every 5 seconds. |
| ledger\_sequence | The sequence number of this ledger. | INTEGER | | Yes | Cluster Field. Unique per ledger. |
| batch\_insert\_ts | The timestamp in UTC when a batch of records was inserted into the database. | TIMESTAMP | | Yes | Useful for data engineering, not for ad hoc analysis. |
| airflow\_start\_ts | The timestamp when the airflow job starts. | STRING | | Yes | Used to detect backfill jobs. |
| valid\_from | The timestamp when this snapshot row was first inserted and became effective. | TIMESTAMP | | Yes | Helps track changes over time. |
| valid\_to | The timestamp when this row is no longer valid. | TIMESTAMP | | No | If null, the setting is currently active. |

## Example Business Questions

1. Point-in-time query (as-of balance)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
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
```

2. Active snapshot (current records only)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT account_id, balance, home_domain
FROM `crypto-stellar.snapshots.accounts_snapshot`
WHERE valid_to IS NULL
LIMIT 100
```

3. Changes in February 2025 (partition pruning)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
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
```
