-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: integration tests for duckdb
#178
base: master
Are you sure you want to change the base?
Conversation
duckdb
900bfc8
to
58e11b9
Compare
58e11b9
to
97e47c4
Compare
97e47c4
to
a29b1dc
Compare
There might be some overlap with this PR: #77 |
a29b1dc
to
581f147
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work! ✨ left some few comments suggestions. Love some tests! 🧪
} | ||
|
||
// SetupSuite initializes an in-memory DuckDB instance. | ||
func (suite *DuckDBTestSuite) SetupSuite() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about moving some of the ddl stuff to the NewDuckDBContainer
construct, similar to e.g. what we did in #177 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, would you suggest to also use a ddl seeds file for this, or just the initialization of it should go in New*Container
methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make any sql statements part of a seed file for easier scalability 😄 IMHO makes it easier to read what is happening in terms of 'logic' 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, you make a seed file for the sql file, then bootstrap that file as part of the NewDuckDBContainer
construct :)
dbee/adapters/duck_driver.go
Outdated
// NOTE: (phdah) As of now, swapping catalogs is not enabled | ||
func (c *duckDriver) SelectDatabase(name string) error { | ||
// no-op | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's return an error here of fmt.Errorf("SelectDabase method not implemented yet")
or something similar. Otherwise, it might be easy to confuse the user that there is a no-op even tho I am selecting a new database 'succesfully'. wdyt? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let me try it out and see 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So returning the error is kinda obstructing. Since the ListDatabases()
only return the database you initially connected to, you can't really change anyway right now. I would suggest to keep the no-op
. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha, ok gotcha!
Hmm I am tempted to say we should wait implementing these methods in a separate PR, then to actually implement them with no-op. Given, we don't want to confuse a user with feature of seeing databases but they aren't seeing what they 'expect'. Then it make sense to show nothing at all (because the feature doesn't exist) 😄
Do you think we'll make a PR adding this before the v0.2.0 release? 😋 if so, we can add this code and update it accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So after not to much looking in to this, one can attach to new/more databases. Then you can run use other_db
and swap between them. But I would say that this is not really how one typically use DuckDB. But I liked the visual "feedback" of seeing what database I was attached to. But if it's possible to disable the select action only, that would maybe be a hybrid solution?
Regardless, I think you're right that this can be it's own PR after v0.2.0
😃 So, lets do that!
} | ||
|
||
// NewDuckDBContainer creates a new in-memory DuckDB instance. | ||
func NewDuckDBContainer(params *core.ConnectionParams) (*DuckDBContainer, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps a bit overengineered but you could make use of the generic testcontainer and boot up duckdb in that see (https://golang.testcontainers.org/features/creating_container/#genericcontainer). Might be useful in the future to remove any remaining local duckdb files or so.
Just adding a comment for idea sharing, no need to move away from the code there is now 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and good point. Not sure if/how duckdb stores in memory databases, but would assume they clean up after themselvs somehow. But in the future when we want to try connecting to persistent databases, perhaps this would be great!
This follows the style and structure of both the postgres and bigquery integration tests.
This is currently just to make the UI show what catalog you start your connection to. So no swapping is enabled. I did play around with `use my_catalog` etc, in the `SelectDatabase()` function, but didn't get it to properly work due to how the `Swap()` function works.
This actually showed issues with the helper function, so great!
5b6f1f8
to
563a215
Compare
Description
This follows the style and structure of both the postgres and bigquery integration tests.
What's left?
Edit: There seems to be some issue with the adapter. Will investigate it. Resolved by commit
98bac14ceda3
:GetResult()
function.GetStructure()
returns empty. Not sure if this is expected or not.catalog
in DuckDB).Status
Fixes
Added schema to DuckDB driver:


Added catalog