Skip to content

Commit 624df30

Browse files
authored
use create if not exist method for cleaner syntax (#22814)
1 parent 78ca962 commit 624df30

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/content/docs/r2/data-catalog/get-started.mdx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ We will use [marimo](https://github.com/marimo-team/marimo) as a Python notebook
171171
import pyarrow.parquet as pq
172172

173173
from pyiceberg.catalog.rest import RestCatalog
174-
from pyiceberg.exceptions import NamespaceAlreadyExistsError
175174

176175
# Define catalog connection details (replace variables)
177176
WAREHOUSE = "<WAREHOUSE>"
@@ -187,7 +186,6 @@ We will use [marimo](https://github.com/marimo-team/marimo) as a Python notebook
187186
)
188187
return (
189188
CATALOG_URI,
190-
NamespaceAlreadyExistsError,
191189
RestCatalog,
192190
TOKEN,
193191
WAREHOUSE,
@@ -200,12 +198,9 @@ We will use [marimo](https://github.com/marimo-team/marimo) as a Python notebook
200198

201199

202200
@app.cell
203-
def _(NamespaceAlreadyExistsError, catalog):
201+
def _(catalog):
204202
# Create default namespace if needed
205-
try:
206-
catalog.create_namespace("default")
207-
except NamespaceAlreadyExistsError:
208-
pass
203+
catalog.create_namespace_if_not_exists("default")
209204
return
210205

211206

0 commit comments

Comments
 (0)