Model configuration
Download JSON Schema
Example
apiVersion: leapview.dev/v1
kind: Model
metadata:
id: model:movies
name: movies
displayName: Movies Dimension
description: Movie dimension with release year, decade, genres, and external identifiers.
spec:
fields:
movie_id:
datatype: Integer
label: Movie ID
description: MovieLens movie identifier.
title:
datatype: String
label: Title
description: Clean movie title.
raw_title:
datatype: String
label: Raw title
description: Original MovieLens title value.
release_year:
datatype: Integer
label: Release year
description: Release year parsed from the title suffix.
release_decade:
datatype: String
label: Release decade
description: Release decade derived from release year.
genres:
datatype: String
label: Genres
description: Pipe-separated genre list.
imdb_id:
datatype: String
label: IMDb ID
description: IMDb title identifier with tt prefix.
tmdb_id:
datatype: Integer
label: TMDb ID
description: TMDb movie identifier.
definition:
type: sql
sql: |
WITH parsed AS (
SELECT
try_cast(m.movieId AS BIGINT) AS movie_id,
m.title AS raw_title,
trim(regexp_replace(m.title, '\s*\(([0-9]{4})\)$', '')) AS title,
try_cast(nullif(regexp_extract(m.title, '\(([0-9]{4})\)$', 1), '') AS INTEGER) AS release_year,
nullif(m.genres, '') AS genres,
nullif(trim(CAST(l.imdbId AS VARCHAR)), '') AS imdb_raw,
nullif(trim(CAST(l.tmdbId AS VARCHAR)), '') AS tmdb_raw
FROM source."movielens.movies" m
LEFT JOIN source."movielens.links" l ON try_cast(l.movieId AS BIGINT) = try_cast(m.movieId AS BIGINT)
)
SELECT
movie_id,
title,
raw_title,
release_year,
CASE
WHEN release_year IS NULL THEN 'Unknown'
ELSE concat(CAST(floor(release_year / 10) * 10 AS INTEGER), 's')
END AS release_decade,
COALESCE(genres, '(no genres listed)') AS genres,
CASE
WHEN imdb_raw IS NULL THEN NULL
ELSE concat('tt', lpad(imdb_raw, 7, '0'))
END AS imdb_id,
try_cast(tmdb_raw AS BIGINT) AS tmdb_id
FROM parsed
WHERE movie_id IS NOT NULL
entities:
movie:
type: primary
fields:
- movie_id
grain:
entity: movie
Fields
| Field |
Type |
Required |
Rules |
aiContext |
AIContext |
No |
|
apiVersion |
string |
Yes |
one of leapview.dev/v1 |
kind |
Model |
Yes |
|
metadata |
ResourceMetadata |
Yes |
|
spec |
ModelSpec |
Yes |
|
Nested definitions
AIContext
| Field |
Type |
Required |
Rules |
examples |
array of string |
No |
|
instructions |
string |
No |
|
synonyms |
array of string |
No |
|
AcceptedValuesModelCheck
| Field |
Type |
Required |
Rules |
field |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
severity |
string |
No |
one of warning, error |
type |
string |
Yes |
one of accepted_values |
values |
array of string |
Yes |
|
AzureBlobConnection
| Field |
Type |
Required |
Rules |
access |
PublicAccess |
No |
|
defaults |
ReaderDefaults |
No |
|
type |
string |
Yes |
one of azure_blob |
BlobPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of blob |
options |
BlobReaderOptions |
No |
|
BlobReaderOptions
| Field |
Type |
Required |
Rules |
compression |
string |
No |
one of auto, none, gzip, zstd |
CSVPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of csv |
options |
CSVReaderOptions |
No |
|
CSVReaderOptions
| Field |
Type |
Required |
Rules |
delimiter |
string |
No |
|
escape |
string |
No |
|
header |
boolean |
No |
|
nullString |
string |
No |
|
quote |
string |
No |
|
CompatibleSourceSchema
| Field |
Type |
Required |
Rules |
fields |
object |
Yes |
|
mode |
string |
Yes |
one of compatible |
Connection
| Field |
Type |
Required |
Rules |
apiVersion |
string |
Yes |
one of leapview.dev/v1 |
kind |
string |
Yes |
one of Connection |
metadata |
ResourceMetadata |
Yes |
|
spec |
ConnectionSpec |
Yes |
|
ConnectionSpec
| Field |
Type |
Required |
Rules |
ConnectionSpecBase
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
|
DeltaPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of delta |
options |
DeltaReaderOptions |
No |
|
DeltaReaderOptions
| Field |
Type |
Required |
Rules |
version |
string |
No |
|
DirectModelDefinition
| Field |
Type |
Required |
Rules |
source |
string |
Yes |
pattern ^[A-Za-z0-9][A-Za-z0-9_.:-]*$ |
type |
string |
Yes |
one of direct |
DuckLakeConnection
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of ducklake |
ExcelPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of excel |
options |
ExcelReaderOptions |
No |
|
ExcelReaderOptions
| Field |
Type |
Required |
Rules |
header |
boolean |
No |
|
sheet |
string |
No |
|
FieldFreshness
| Field |
Type |
Required |
Rules |
basis |
string |
Yes |
one of field |
errorAfter |
FreshnessDuration |
No |
|
field |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
warningAfter |
FreshnessDuration |
No |
|
FreshnessDuration
| Field |
Type |
Required |
Rules |
amount |
integer |
Yes |
|
unit |
string |
Yes |
one of second, minute, hour, day |
GCSConnection
| Field |
Type |
Required |
Rules |
access |
PublicAccess |
No |
|
defaults |
ReaderDefaults |
No |
|
type |
string |
Yes |
one of gcs |
HTTPConnection
| Field |
Type |
Required |
Rules |
access |
PublicAccess |
No |
|
defaults |
ReaderDefaults |
No |
|
type |
string |
Yes |
one of http |
IcebergPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of iceberg |
options |
IcebergReaderOptions |
No |
|
IcebergReaderOptions
| Field |
Type |
Required |
Rules |
snapshot |
string |
No |
|
InferredSourceSchema
| Field |
Type |
Required |
Rules |
mode |
string |
Yes |
one of inferred |
JSONPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of json |
options |
JSONReaderOptions |
No |
|
JSONReaderOptions
| Field |
Type |
Required |
Rules |
format |
string |
No |
one of auto, array, newline_delimited |
maximumDepth |
integer |
No |
|
LancePathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of lance |
ManagedConnection
| Field |
Type |
Required |
Rules |
access |
PublicAccess |
No |
|
defaults |
ReaderDefaults |
No |
|
type |
string |
Yes |
one of managed |
Model
| Field |
Type |
Required |
Rules |
aiContext |
AIContext |
No |
|
apiVersion |
string |
Yes |
one of leapview.dev/v1 |
kind |
Model |
Yes |
|
metadata |
ResourceMetadata |
Yes |
|
spec |
ModelSpec |
Yes |
|
ModelCheck
| Field |
Type |
Required |
Rules |
ModelCheckAcceptedValuesVariant
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of accepted_values |
ModelCheckNonNullVariant
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of non_null |
ModelCheckRelationshipVariant
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of relationship |
ModelCheckRowCountVariant
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of row_count |
ModelCheckUniqueVariant
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of unique |
ModelDefinition
| Field |
Type |
Required |
Rules |
ModelDefinitionBase
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
|
ModelEntity
| Field |
Type |
Required |
Rules |
aiContext |
AIContext |
No |
|
description |
string |
No |
|
fields |
array of string |
Yes |
|
type |
string |
Yes |
one of primary, unique, foreign, natural |
ModelField
| Field |
Type |
Required |
Rules |
aiContext |
AIContext |
No |
|
datatype |
string |
No |
one of String, Integer, Decimal, Float, Boolean, Date, Time, DateTime, DateTimeTz, Opaque |
description |
string |
No |
|
label |
string |
No |
|
ModelGrain
| Field |
Type |
Required |
Rules |
entity |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
ModelSpec
| Field |
Type |
Required |
Rules |
checks |
array of ModelCheck |
No |
|
definition |
ModelDefinition |
Yes |
|
entities |
object |
Yes |
|
fields |
object |
No |
|
grain |
ModelGrain |
Yes |
|
MySQLConnection
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of mysql |
NonNullModelCheck
| Field |
Type |
Required |
Rules |
field |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
severity |
string |
No |
one of warning, error |
type |
string |
Yes |
one of non_null |
ParquetPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of parquet |
options |
ParquetReaderOptions |
No |
|
ParquetReaderOptions
| Field |
Type |
Required |
Rules |
hivePartitioning |
boolean |
No |
|
unionByName |
boolean |
No |
|
PathSourceLocation
| Field |
Type |
Required |
Rules |
PathSourceLocationBase
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
|
path |
string |
Yes |
|
type |
string |
Yes |
one of path |
PostgresConnection
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of postgres |
PublicAccess
| Field |
Type |
Required |
Rules |
QuackConnection
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of quack |
R2Connection
| Field |
Type |
Required |
Rules |
access |
PublicAccess |
No |
|
defaults |
ReaderDefaults |
No |
|
type |
string |
Yes |
one of r2 |
ReaderDefaults
| Field |
Type |
Required |
Rules |
blob |
BlobReaderOptions |
No |
|
csv |
CSVReaderOptions |
No |
|
delta |
DeltaReaderOptions |
No |
|
excel |
ExcelReaderOptions |
No |
|
iceberg |
IcebergReaderOptions |
No |
|
json |
JSONReaderOptions |
No |
|
parquet |
ParquetReaderOptions |
No |
|
text |
TextReaderOptions |
No |
|
vortex |
VortexReaderOptions |
No |
|
RelationSourceLocation
| Field |
Type |
Required |
Rules |
catalog |
string |
No |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
name |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
schema |
string |
No |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
type |
string |
Yes |
one of relation |
RelationshipModelCheck
| Field |
Type |
Required |
Rules |
field |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_]*$ |
severity |
string |
No |
one of warning, error |
to |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)*\.[A-Za-z_][A-Za-z0-9_]*$ |
type |
string |
Yes |
one of relationship |
| Field |
Type |
Required |
Rules |
description |
string |
No |
|
displayName |
string |
No |
|
documentation |
string |
No |
|
domain |
string |
No |
|
id |
string |
Yes |
pattern ^[A-Za-z0-9][A-Za-z0-9_.:-]*$ |
name |
string |
Yes |
pattern ^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)*$ |
owner |
string |
No |
|
provenance |
ResourceProvenance |
No |
|
tags |
array of string |
No |
|
ResourceProvenance
| Field |
Type |
Required |
Rules |
origin |
string |
No |
|
path |
string |
No |
|
source |
string |
No |
|
RevisionFreshness
| Field |
Type |
Required |
Rules |
basis |
string |
Yes |
one of revision |
errorAfter |
FreshnessDuration |
No |
|
revision |
string |
Yes |
|
warningAfter |
FreshnessDuration |
No |
|
RowCountModelCheck
| Field |
Type |
Required |
Rules |
maximum |
integer |
No |
|
minimum |
integer |
No |
|
severity |
string |
No |
one of warning, error |
type |
string |
Yes |
one of row_count |
S3Connection
| Field |
Type |
Required |
Rules |
access |
PublicAccess |
No |
|
defaults |
ReaderDefaults |
No |
|
type |
string |
Yes |
one of s3 |
SQLModelDefinition
| Field |
Type |
Required |
Rules |
sql |
string |
Yes |
|
type |
string |
Yes |
one of sql |
SQLiteConnection
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of sqlite |
Source
| Field |
Type |
Required |
Rules |
apiVersion |
string |
Yes |
one of leapview.dev/v1 |
kind |
string |
Yes |
one of Source |
metadata |
ResourceMetadata |
Yes |
|
spec |
SourceSpec |
Yes |
|
SourceFreshness
| Field |
Type |
Required |
Rules |
SourceFreshnessFieldVariant
| Field |
Type |
Required |
Rules |
basis |
string |
Yes |
one of field |
SourceFreshnessRevisionVariant
| Field |
Type |
Required |
Rules |
basis |
string |
Yes |
one of revision |
SourceLocation
| Field |
Type |
Required |
Rules |
SourceLocationPathVariant
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of path |
SourceLocationRelationVariant
| Field |
Type |
Required |
Rules |
type |
string |
Yes |
one of relation |
SourceSchema
| Field |
Type |
Required |
Rules |
SourceSchemaCompatibleVariant
| Field |
Type |
Required |
Rules |
mode |
string |
Yes |
one of compatible |
SourceSchemaField
| Field |
Type |
Required |
Rules |
datatype |
string |
Yes |
one of String, Integer, Decimal, Float, Boolean, Date, Time, DateTime, DateTimeTz, Opaque |
description |
string |
No |
|
nullable |
boolean |
No |
|
SourceSchemaInferredVariant
| Field |
Type |
Required |
Rules |
mode |
string |
Yes |
one of inferred |
SourceSchemaStrictVariant
| Field |
Type |
Required |
Rules |
mode |
string |
Yes |
one of strict |
SourceSpec
| Field |
Type |
Required |
Rules |
connection |
string |
Yes |
pattern ^[A-Za-z0-9][A-Za-z0-9_.:-]*$ |
freshness |
SourceFreshness |
No |
|
location |
SourceLocation |
Yes |
|
schema |
SourceSchema |
No |
|
StrictSourceSchema
| Field |
Type |
Required |
Rules |
fields |
object |
Yes |
|
mode |
string |
Yes |
one of strict |
TextPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of text |
options |
TextReaderOptions |
No |
|
TextReaderOptions
| Field |
Type |
Required |
Rules |
delimiter |
string |
No |
|
header |
boolean |
No |
|
quote |
string |
No |
|
UniqueModelCheck
| Field |
Type |
Required |
Rules |
fields |
array of string |
Yes |
|
severity |
string |
No |
one of warning, error |
type |
string |
Yes |
one of unique |
VortexPathSourceLocation
| Field |
Type |
Required |
Rules |
format |
string |
Yes |
one of vortex |
options |
VortexReaderOptions |
No |
|
VortexReaderOptions
| Field |
Type |
Required |
Rules |
version |
string |
No |
|