feat: implement InMemoryCatalog as a subclass of SqlCatalog
closes: #1110
This PR implement a new catalog InMemoryCatalog as a subclass of SqlCatalog with SQLite in-memory.
@kevinjqliu I applied what you suggested in the comment above, could you recheck it now?
@Fokko wydt of this change? i remember we had past discussions on adding a "new" catalog implementation
@hussein-awala Thanks for working on this 🚀 @kevinjqliu Regarding the new catalogs, my main concern was a proliferation of new catalogs, and that they would lack maintenance. I do like this change for two reasons:
- It moves out of the
InMemoryCatalogthat's specific to tests. We want to have the catalog as part of the tests, otherwise we're testing a catalog that's not part of the normal code-path. - It merges the InMemory catalog into the SqlCatalog. This way, when new features are released, such as support for views, multi-table transactions, etc. we have fewer places where we need to implement them.
I'm positive about this change. The only consideration I could make is that we hide the SqlCatalog behind the InMemoryCatalog. Maybe it is interesting for folks to know that they can easily switch to a persistent catalog. What are your thoughts?
I'm positive about this change. The only consideration I could make is that we hide the SqlCatalog behind the InMemoryCatalog. Maybe it is interesting for folks to know that they can easily switch to a persistent catalog. What are your thoughts?
I think it would be good to document the InMemoryCatalog, perhaps in the catalog section of the configuration page. We can mention that it uses the SqlCatalog under the hood and to use another catalog implementation to persist the catalog metadata
hey @hussein-awala would you like to make the above changes on docs? This PR is almost ready!
hey @hussein-awala would you like to make the above changes on docs? This PR is almost ready!
yes, I will make it ready ASAP
Or just:
catalog = load_catalog('default', 'type'='in-memory', 'warehouse'='/tmp/pyiceberg/warehouse')
I agree that this catalog impl is mostly focussed on testing/demonstration. If you would use a Jupyter notebook, each time you restart the kernel, then you end up with a fresh catalog (don't have to clean up any old stuff lingering around).
Thanks for the contribution @hussein-awala and thanks for the review @Fokko