Skip to content

dy admin create table should update the table cache #203

@StoneDot

Description

@StoneDot

We should update the table cache after creating a table and delete the cache after deleting a table.

Due to the lack of the above update, dynein raises an unintended error when you take the following steps:

  1. Execute dy admin create table issue --keys pk,S.
  2. Execute dy use issue.
  3. Execute dy admin delete table --yes issue.
  4. Execute dy admin create table issue --keys pk,N.
  5. Execute dy put 1.

The above steps raise the following error message.

[2024-03-28T14:45:41Z ERROR dy::data] One or more parameter values were invalid: Type mismatch for key

The final state is as follows:

❯ cat ~/.dynein/config.yml
---
using_region: local
using_table: issue
using_port: 8000

❯ cat ~/.dynein/cache.yml
---
tables:
  local/issue:
    region: local
    name: issue
    pk:
      name: pk
      kind: S
    sk: ~
    indexes: ~
    mode: OnDemand

To reveal the root cause, change the ~/.dynein/cache.yml.

❯ cat ~/.dynein/cache.yml
---
tables:
  local/issue:
    region: local
    name: issue
    pk:
      name: pk
      kind: N
    sk: ~
    indexes: ~
    mode: OnDemand

❯ dy put 1
Successfully put an item to the table 'issue'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions