Fokko commented on issue #406:
URL: https://github.com/apache/iceberg-python/issues/406#issuecomment-1948187320
@Gowthami03B That would be great! 👍
One note here:
> important if we just want to check that a table exists in a namespace. I'd
argue this is the same as calling list_tables and checking if the table exists
in the returned list, and hence isn't as critical to implement as 'CREATE TABLE
IF NOT EXISTS'
I think it would make more sense to do an actual `load_table` instead of
calling `list_tables`, mostly because there is a discussion on the REST spec to
add pagination. Calling the `list_table` would then result in many consecutive
requests to build up the list, which is not very performant. For the
`load_table` we load the metadata, but I think that's okay.
Thanks @syun64 for summarizing the options.
> An alternative is just to ask users to try and catch
TableAlreadyExistsError in their code when calling create_table
I believe this is the most Pythonic way of doing it, but I agree that we
could mirror the SQL `CREATE IF NOT EXISTS`. How about adding this to the
`Catalog(ABC)` itself. This way we don't have to add this logic to each of the
implementations:
```python
catalog = load_catalog('default')
catalog.create_table_if_not_exists('schema.table', schema=...)
```
Thoughts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]