Saiba mais sobre paginação e veja exemplos de como implementar consultas paginadas no pipeline.
Exemplo de entrada (JSON):
{
"page" : 1,
"pageSize" : 50
}
Oracle
SELECT COL_A, COL_BFROM (SELECT COL_A, COL_B,row_number() over (order by COL_A) rnFROM XPTO.MY_TABLE )WHERE rn BETWEEN {{ TOLONG(SUM(SUBTRACT(MULTIPLY(message.page, message.pageSize), message.pageSize), 1)) }}AND {{ TOLONG(MULTIPLY(message.page, message.pageSize)) }}
SQL Server
SELECT col_a, col_b FROM myTabel ORDER BY col_a OFFSET {{ TOLONG(SUM(SUBTRACT(MULTIPLY(message.page, message.pageSize), message.pageSize), 1)) }} ROWSFETCHNEXT {{ message.pageSize}} ROWS ONLY
Data Bricks (managed Apache Spark)
WITH CTEResults AS( SELECT*, ROW_NUMBER() OVER (ORDERBY query.col_1) AS RowNum FROM(selectdistinct col_1, col_2, col_3from mytablewhere<< YOUR FILTERS HERE>>orderby col_1) query)SELECT*FROM CTEResultswhere RowNum > {{ TOLONG(SUBTRACT(MULTIPLY(message.page, message.pageSize), message.pageSize)) }} and RowNum <= {{ TOLONG(MULTIPLY(message.page, message.pageSize)) }}Sp