dolthub / dolthub/dolthub-issues

CSV download for view that exists on non-`main` branch errors

Open
#581 0 comments 0 reactions 2 assignees Claimed by @liuliu-dev View on GitHub
bug
Dominant language
No language data
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

We have a user that's trying to download a csv of a view on a branch that's not `main` and is getting a `table not found` error. We thought it was related to views not working with `as of` ([this issue](https://github.com/dolthub/dolt/issues/9201)), but using the ```select * from `view-test/newbranch`.test2``` syntax doesn't work either even though it works in dolt. It seems like something with how we set up the dolt database using in dolthubapi [here](https://github.com/dolthub/ld/blob/main/go/services/dolthubapi/pkg/domain/dhdolt/dolt_session.go#L171). [This](https://github.com/dolthub/ld/pull/14422) is the PR where this was added

I added some unit tests [here](https://github.com/dolthub/ld/pull/20333/files#diff-101163e76a4cb4bcd010166701be9700081b169ee2340c098612c3c0879460adR328). I can get the branch test to pass by passing in the `refName` instead of an empty string to `GetStreamingSqlReadQueryResults` [here](https://github.com/dolthub/ld/blob/main/go/services/dolthubapi/pkg/service/csv_http.go#L220) but that doesn't work for commit refs

This is also reproducible on any repo with a view on a non-main branch using the DoltHub SQL console (example [here](https://dolthub.awsdev.ld-corp.com/repositories/dolthub/test-repo-mayo/query/main?active=Tables&q=SELECT+*+FROM+%60test-repo-mayo%2Fanother-branch%60.%60only_on_branch%60%0A)) and comparing to Dolt

Image

```sql
taylor@MacBook-Pro-6 test-repo-mayo % dolt sql
# Welcome to the DoltSQL shell.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit. "\help" for help.
test-repo-mayo/main> SELECT * FROM `test-repo-mayo/another-branch`.`only_on_branch`;
+----+------------+
| id | some_pk |
+----+------------+
| 1 | 1705931475 |
+----+------------+
1 row in set (0.01 sec)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.