Skip to content

Can't use list() on external DB with composite identifier #3329

@PaulSut

Description

@PaulSut

Bug Summary

When using an external PostgreSQL database with a table that has a composite primary key (i.e., a primary key composed of multiple columns), the list() query fails.


Schema Definition

The generated model schema looks like this:

"overview": a.model({
  a: a.string().required(),
  b: a.date().required(),
  c: a.integer(),
  d: a.float(),
  e: a.float(),
}).identifier(["a", "b"]) // composite primary key

Query Used

client.models.overview.list({
  limit: 5,
});

Observed Behavior

The query fails with the following error:

Validation error of type UnknownType: Unknown type b

Expected Behavior

The query should return the first 5 entries from the overview table, just like it would for a table with a single-column primary key.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions