Repository navigation
Commit ef253bc
committed
fix(query): resolve --database name/catalog to id
`hotdata query --database <name>` (or a catalog alias) failed with
"Database '<name>' not found" -- only an opaque database id worked --
while `databases tables`, `tables delete --database`, and
`databases delete` all accept a name or id.
Root cause: query::execute passed the raw --database flag straight to
scoped_to_database_opt, which stores it verbatim as the X-Database-Id
header value. It never ran the name->id lookup the other subcommands do
via resolve_database, so the server rejected any non-id value.
Fix: resolve the flag through resolve_database (id-first, then catalog
alias, then name) before scoping. Omitting the flag still passes through
untouched, preserving the construction-time default database.
Added a regression test asserting a --database name resolves to its id
and that None passes through without a lookup. Verified end-to-end
against the live API: name, catalog, id, and no-flag all work; an unknown
value gives the same clean error as the other subcommands.1 parent 977aec2 commit ef253bc
1 file changed
Lines changed: 52 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
442 | 451 | | |
443 | 452 | | |
444 | 453 | | |
445 | 454 | | |
446 | 455 | | |
447 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
448 | 459 | | |
449 | 460 | | |
450 | 461 | | |
| |||
717 | 728 | | |
718 | 729 | | |
719 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
720 | 771 | | |
721 | 772 | | |
722 | 773 | | |
| |||
0 commit comments