Sample Rows
data.sample_rows
Overview
When you send JSON rows or a CSV file reference, we return a deterministic sample using first, last, systematic, content-hash, seeded-random, or stratified methods. The same seed and input always yield the same rows — we never use runtime randomness. Do not use this for statistically rigorous survey sampling.
Reproducible sampling is essential for debugging and audits — you need the same rows every time, not a different draw on each call.
Reliability
There is no randomness here at all: the same dataset, method and seed always return exactly the same rows, whatever machine or day you run on. hash ranks every row by a SHA-256 digest of its content and keeps the lowest ones, so it follows the data and ignores the seed — two datasets sharing a row will sample that row alike. seeded_random digests the seed together with each row's position and content, so a new seed gives a different draw you can still reproduce. Ties break on the original position, and stratified fills each group's quota from its earliest rows. None of these refusals is worth retrying unchanged: sending both rows and fileRef or neither, choosing stratified without stratifyBy, pointing fileRef at anything but CSV, and a dataset over 100,000 rows.
Context footprint
Returns sample, inputRowCount, sampleRowCount, method, and seed. A successful call costs 1 execution credit.
When to use it
When you want a bounded, deterministic subset with a known method and seed.
When you need rigorous statistical inference or weighted population sampling.
Scope
Non-goals
- Does not use runtime randomness
- Does not modify the source dataset
- Does not guarantee statistical representativeness
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
File limits
Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 9.5 MiB | Skill and platform maximum |
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| rows | array | No | Bounded array of 0 through 100000 input row objects keyed by column name; omit it when fileRef is the source. |
| fileRef | string | No | Tenant-scoped uploaded CSV reference. Omit it to use the required inline rows; never send both. |
| method | string | No | Sampling method; omit it for first. |
| format | string | No | File format when fileRef is used; omit it for csv. |
| hasHeader | boolean | No | Whether the CSV first line names columns; omit it for true. |
| sampleSize | integer | No | How many rows to return; omit it for 100. |
| seed | string | No | Seed used by seeded_random; omit it for squillify. |
| stratifyBy | string | No | Column that defines stratified groups; required unless method is not stratified. |
| includeRowNumbers | boolean | No | Whether _rowNumber is added; omit it for true. |
| orderBySampleKey | boolean | No | Whether hash or seeded_random results are returned in digest order; omit it for false. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| sample | array | Yes | Bounded array of 0 through 100000 input row objects keyed by column name, where missing keys count as null. |
| inputRowCount | integer | Yes | How many rows the dataset held before sampling. |
| sampleRowCount | integer | Yes | How many rows came back, at most sampleSize. |
| method | string | Yes | Sampling method actually applied. |
| seed | string | Yes | Seed actually used, including the default squillify. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"data.sample_rows","input":{"rows":[{"id":1,"name":"Alice"}],"sampleSize":1,"method":"first"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("data.sample_rows", {"rows":[{"id":1,"name":"Alice"}],"sampleSize":1,"method":"first"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not use runtime randomness
- Does not modify the source dataset
- Does not guarantee statistical representativeness
- Statistically rigorous survey sampling
- Unbounded streaming samples
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "data.sample_rows",
"input": {
"rows": [
{
"id": 1,
"name": "Alice"
}
],
"sampleSize": 1,
"method": "first"
}
}Examples
First row with row number metadata
{
"rows": [
{
"id": 1,
"name": "Alice"
}
],
"sampleSize": 1,
"method": "first"
}{
"method": "first",
"sample": [
{
"name": "Alice",
"_rowNumber": 1,
"id": 1
}
],
"seed": "squillify",
"sampleRowCount": 1,
"inputRowCount": 1
}Hash-based sample with custom seed
{
"seed": "audit-2026",
"rows": [
{
"id": 1
},
{
"id": 2
},
{
"id": 3
}
],
"method": "hash",
"sampleSize": 2
}{
"method": "hash",
"sample": [
{
"id": 1,
"_rowNumber": 1
},
{
"id": 2,
"_rowNumber": 2
}
],
"seed": "audit-2026",
"sampleRowCount": 2,
"inputRowCount": 3
}Recommended use cases
- Debugging with a fixed subset
- Audit trails with seeded selection
- Preview a dataset before heavier processing
Avoid for
- Statistically rigorous survey sampling
- Unbounded streaming samples
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.