SHOW statement
Change Feeds allows you to retrieve and sync changes from SurrealDB to external systems and platforms using the SHOW statement.
The SHOW statement can be used to replay changes made to a table.
Requirements
You must first
DEFINEa changefeed on either a table or a database.
Statement syntax
Example usage
Basic usage
The following expression shows usage of the SHOW statement.
Assuming the datetime above matches with the one when the changefeed was established, the response for both queries will be as follows.
Note the following when working with the versionstamps of a changefeed:
Changefeeds defined on tables are implemented via a single
CHANGEFEEDon the database level. As such,SHOW CHANGES FOR TABLE sometablewill only show versionstamps in sequential order ifsometableis the database's only table.The
versionstampoutput above is due to an extra two bytes needed for more detailed ordering needed in the FoundationDB distributed SurrealDB backend. To turn these versionstamps into a normal sequence of numbers, a right shift of sixteen bits (>> 16) can be used.A
SINCE <numbergreater than the current sequential number will return an empty array.SINCE <time>needs to be a datetime after which theCHANGEFEEDwas defined.
Versionstamps carry the following two guarantees:
Versionstamps monotonically increase.
Versionstamp format is universal across various backends.