Cannot add a DuckDB source (Source Name is Required)
Describe the bug
The short description is that when you try to add a DuckDB data source, nothing happens. You click the button and there's nothing.
The longer answer is that the submit form doesn't pass the yup schema validation. I'll add more of my debugging under Additional Context.
To Reproduce Steps to reproduce the behavior:
- Go to add a data source, either from the welcome page or in a dashboard
- Select the DuckDB connector
- Provide a DB name (valid, invalid, doesn't matter)
- Submit the form (press enter or click the button--the form does submit)
- Observe that nothing happens. Nothing in the UI, nothing in the console, nothing in the network tab
Expected behavior
I expected my DuckDB database to be added as a datasource in my Rill project.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: macOS
- Browser Chrome
- Version 126.0.6478.63
Additional context
The complete lack of feedback was oddly alluring to me, so I went digging.
First I dug through the code to figure out where to put a breakpoint. It's here in RemoteSourceForm as you know. https://github.com/rilldata/rill/blob/e662722c8a7d16ae27cc1f71e70a616667f6ae7d/web-common/src/features/sources/modal/RemoteSourceForm.svelte#L32-L55
Then I found that code in Chrome's sources tab, but the breakpoint never got hit. Clearly something was happening inside of svelte-form-libs, but I wasn't about to crack that open. Instead I did what I should have done in the first place: pause on caught exceptions, which yields this:
So a validation error is being caught but not presented to the user (probably its own bug, but not what I'm reporting).
The DuckDB schema does indeed expect a source name: https://github.com/rilldata/rill/blob/e662722c8a7d16ae27cc1f71e70a616667f6ae7d/web-common/src/features/sources/modal/yupSchemas.ts#L47-L54
Except the connection form does not have this input:
Sure enough the connector does not have a source field, so it doesn't come through the meta endpoint: https://github.com/rilldata/rill/blob/e662722c8a7d16ae27cc1f71e70a616667f6ae7d/runtime/drivers/duckdb/duckdb.go#L53-L61
And it is an OLAP connector so it doesn't get the field auto-added client-side: https://github.com/rilldata/rill/blob/e662722c8a7d16ae27cc1f71e70a616667f6ae7d/web-common/src/features/sources/modal/RemoteSourceForm.svelte#L61-L75
Proposed solution
I don't know! I would have opened a PR if the fix for the bug was obvious, but it seems like there are plans in place that I can't divine from the source code alone.
Though the way other OLAP connectors are handled is a clue, maybe? https://github.com/rilldata/rill/blob/e662722c8a7d16ae27cc1f71e70a616667f6ae7d/web-common/src/features/sources/modal/yupSchemas.ts#L157-L169
Thanks for the report! Will get that fixed. In the meantime you can create the file from scratch such as
type: "source"
connector: "duckdb"
sql: "SELECT * from <duckdb_table>"
db: "<path_to_duckdb_db_file>"`
Thanks for the report! Will get that fixed. In the meantime you can create the file from scratch such as
type: "source" connector: "duckdb" sql: "SELECT * from <duckdb_table>" db: "<path_to_duckdb_db_file>"`
This ingests the duckdb table into main.db. My expectation was the db to be treated as an external OLAP source with queries run directly on it rather than ingested wholesale. Am I missing something?