TobikoData / sqlmesh

Efficient data transformation and modeling framework that is backwards compatible with dbt.

Home Page:https://sqlmesh.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Schema inference for TEXT[] incorrectly generates as ARRAY [postgres]

ma1f opened this issue · comments

commented

Not a biggy, but sqlmesh create_external_models infers TEXT[] as ARRAY (invalid) in postgres.

hi could you please provide a bit more detail of the issue? can you describe a minimally reproducible example, this will help us a lot, thanks!

commented

sure, see below. Obviously a simple find/replace is a simple workaround (otherwide causes errors in models), but thought worth raising.

create table users (
    id             bigint generated always as identity primary key,
    _timestamp     timestamp default CURRENT_TIMESTAMP not null,
    name           text not null,
    email          text unique,
    mobile         text,
    job_role       text,
    goals          text[],
    active         boolean
);

and corresponding schema.yaml

- name: 'xxx.users'
  columns:
    id: BIGINT
    _timestamp: TIMESTAMP
    name: TEXT
    email: TEXT
    mobile: TEXT
    job_role: TEXT
    goals: ARRAY   <-- this should be TEXT[]
    active: BOOLEAN