google / google/python-spanner-orm

`find`, `find_multi` don't work for unordered composite keys

未关闭
#192 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
41
派生
17
PR 合并指标
30 天内没有已合并 PR

描述

Didn't see it anywhere in the docs, so filing this as a bug

When you declare a model with more than one primary key, say

```
class FooModel(spanner_orm.Model):
__table__ = "products"
bar = spanner_orm.Field(spanner_orm.String(), primary_key=True)
baz = spanner_orm.Field(spanner_orm.String(), primary_key=True)
```

If the table's schema is defined having the column `baz` before `bar`, `find_multi` (and therefore also `find`) won't work properly, as the keyset is compound in different order (ie: `Product.find(bar="123", baz="456")` will instead do `Product.find(baz="123", bar="456")`.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。