<@U04S8PLJWMT> which table in airbyte db has curso...
# replication-ask-ai
s
@kapa.ai which table in airbyte db has cursor field value of a stream for a connection
k
The cursor field value for a stream is stored in the
state
table in Airbyte's internal Postgres database. You can access it by connecting to the database:
Copy code
docker exec -ti airbyte-db psql -U docker -d airbyte
Then query the table:
Copy code
SELECT * FROM state;
The
state
column contains a JSON object that includes the cursor value. For example:
Copy code
{
  "state": {
    "cdc": false,
    "streams": [
      {
        "cursor": "2022-09-02T07:55:58.324989",
        "stream_name": "table_one",
        "cursor_field": [
          "updated_at"
        ],
        "stream_namespace": "public"
      }
    ]
  }
}
The table also has a
connection_id
column to identify which connection the state belongs to. [Incremental Sync Tutorial] If you need to manually update the cursor value, you can use a command like:
Copy code
UPDATE state 
SET state = jsonb_set(state, '{state, streams, 0, cursor}', '"2022-01-25T00:00:00.000000Z"', false) 
WHERE connection_id = '<your-connection-id>';
[Forum: Manually Defined Cursor] 👍 0 button 👎 0 button â„šī¸ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
s
@kapa.ai can i know what cursor it had in previous run
k
The knowledge sources do not contain enough information to confirm whether Airbyte stores a full history of previous cursor values. The
state
table only stores the most recent cursor value for each stream/connection — it gets overwritten after each sync. However, there are a couple of approaches you could explore: 1. Check the Connection Timeline in the UI — Airbyte's Connection Timeline records historical sync events, which may help you correlate when a cursor value changed. [Connection Timeline] 2. View current state via the UI — The Connection State panel (under Settings > Advanced) shows the current cursor values, but not previous ones. [Connection State] 3. PyAirbyte API — If you're using PyAirbyte, the
get_state_artifacts()
method on a
CloudConnection
object returns the current persisted state, but again only the latest. [PyAirbyte Reference] In short, Airbyte does not appear to natively retain a history of past cursor values — only the latest state is persisted. If tracking cursor history is important to you, you would need to implement an external solution to periodically snapshot the
state
table. 👍 0 button 👎 0 button â„šī¸ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.