Skip to main content
slice(list, start_index, end_index) returns the elements of list from index start_index (inclusive) to end_index (exclusive).

Signature

Example

Run only the first batch of migration files in a staged rollout, deferring the rest to a later run:
With the default batch_size of 2, only 001_create_users.sql and 002_add_email_index.sql are applied.

Notes

  • start_index is inclusive, end_index is exclusive. slice(list, 0, 2) returns elements at index 0 and 1.
  • If end_index equals start_index, the result is an empty list.
  • slice also works on tuples. When applied to a tuple, the result is a tuple.
  • Indices out of bounds produce an error.