| name | extract |
| description | Extract both schema and data from a JDBC source |
Extract Skill
Combines schema extraction and data extraction in a single command. First extracts the database schema metadata into Starlake YAML files, then extracts the actual data into files. This is a convenience command that runs extract-schema followed by extract-data.
Usage
starlake extract [options]
Options
Combines all options from extract-schema and extract-data.
Schema Extraction Options
--config <value>: Database tables & connection info
--outputDir <value>: Where to output YML files
--tables <value>: Database tables to extract
--connectionRef <value>: JDBC connection reference
--all: Extract all schemas and tables
--external: Output YML files to the external folder
--parallelism <value>: Parallelism level
--snakecase: Apply snake_case to column names
Data Extraction Options
--limit <value>: Limit number of records
--numPartitions <value>: Partition parallelism
--ignoreExtractionFailure: Continue on extraction failure
--clean: Clean target files before extraction
--incremental: Export only new data since last extraction
--includeSchemas <value>: Domains to include
--excludeSchemas <value>: Domains to exclude
--includeTables <value>: Tables to include
--excludeTables <value>: Tables to exclude
--reportFormat <value>: Report output format: console, json, or html
Configuration Context
Extract commands use a configuration file (metadata/extract/{name}.sl.yml) to define which schemas and tables to extract:
version: 1
extract:
connectionRef: "duckdb"
jdbcSchemas:
- schema: "starbake"
tables:
- name: "*"
tableTypes:
- "TABLE"
Advanced Extract Configuration
version: 1
extract:
connectionRef: "source_postgres"
jdbcSchemas:
- schema: "sales"
tableTypes:
- "TABLE"
- "VIEW"
tables:
- name: "orders"
fullExport: false
partitionColumn: "id"
numPartitions: 4
timestamp: "updated_at"
fetchSize: 1000
- name: "customers"
fullExport: true
Connection Configuration
The connection referenced in the extract config must be defined in application.sl.yml:
version: 1
application:
connections:
source_postgres:
type: jdbc
options:
url: "jdbc:postgresql://{{PG_HOST}}:{{PG_PORT}}/{{PG_DB}}"
driver: "org.postgresql.Driver"
user: "{{DATABASE_USER}}"
password: "{{DATABASE_PASSWORD}}"
REST API Extract Configuration
Extract schemas and data from REST API endpoints. See dedicated skills for full details:
version: 1
extract:
restAPI:
baseUrl: "https://api.example.com/v2"
auth:
type: bearer
token: "{{API_TOKEN}}"
rateLimit:
requestsPerSecond: 10
defaults:
pagination:
type: offset
limitParam: "limit"
offsetParam: "offset"
pageSize: 100
endpoints:
- path: "/customers"
as: "customer"
domain: "crm"
responsePath: "$.data"
incrementalField: "updated_at"
Supported auth types: bearer, api_key, basic, oauth2_client_credentials.
Supported pagination: offset, cursor, link_header, page_number.
OpenAPI Extract Configuration
Extract schemas from OpenAPI/Swagger specifications:
version: 1
extract:
openAPI:
basePath: /api/v2
domains:
- name: customers_api
schemas:
exclude:
- "Model\\.Common\\.Id"
- "Internal\\..*"
routes:
- paths:
include:
- "/users"
- "/orders"
- "/products"
Freshness Monitoring
Track data freshness with timestamp columns after extraction:
starlake freshness --tables dataset1.table1,dataset2.table2 --persist true
Monitoring table: SL_LAST_EXPORT in audit schema.
Examples
Extract Schema and Data
starlake extract --config externals --outputDir metadata/load
Extract with Incremental Mode
starlake extract --config source_db --outputDir /tmp/output --incremental
Extract Specific Tables
starlake extract --config source_db --tables sales.orders,sales.customers
Related Skills