Skip to content

Commit c76cc61

Browse files
committed
fix: align default schema and query run statuses with runtimedb
- Change default schema public to main to match runtimedb DEFAULT_SCHEMA_NAME; runtimedb auto-inserts main into every managed database, so using public silently created a spurious empty main schema alongside the declared one - Trim _IN_FLIGHT to {running} — runtimedb QueryRunStatus only emits running, succeeded, and failed; queued and pending are result statuses - Update README examples to use main schema throughout
1 parent 3281852 commit c76cc61

3 files changed

Lines changed: 17 additions & 16 deletions

File tree

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ con = ibis.hotdata.connect(
2525
)
2626

2727
# 1. Create a database and declare the tables you'll load
28-
con.create_database("sales", schema="public", tables=["orders"])
28+
con.create_database("sales", tables=["orders"])
2929

3030
# 2. Upload a pandas DataFrame (or PyArrow table)
3131
df = pd.DataFrame({
3232
"order_id": [1, 2, 3],
3333
"amount": [9.99, 49.99, 5.00],
3434
"region": ["west", "east", "west"],
3535
})
36-
con.create_table("orders", df, database=("sales", "public"), overwrite=True)
36+
con.create_table("orders", df, database=("sales", "main"), overwrite=True)
3737

3838
# 3. Uploads are async — wait briefly before querying
3939
time.sleep(2)
4040

4141
# 4. Query with Ibis expressions
4242
# Managed tables are always accessed with catalog "default"
43-
t = con.table("orders", database=("default", "public"))
43+
t = con.table("orders", database=("default", "main"))
4444
result = (
4545
t.group_by("region")
4646
.agg(total=t.amount.sum())
@@ -49,7 +49,7 @@ result = (
4949
)
5050

5151
# 5. Clean up
52-
con.drop_table("orders", database=("sales", "public"))
52+
con.drop_table("orders", database=("sales", "main"))
5353
con.drop_database("sales")
5454
```
5555

@@ -90,22 +90,22 @@ Managed databases are the primary way to bring data into Hotdata with Ibis. Decl
9090

9191
```python
9292
# Declare the database and all table names up front
93-
con.create_database("analytics", schema="public", tables=["events", "users"])
93+
con.create_database("analytics", tables=["events", "users"])
9494

9595
# Upload from a pandas DataFrame
96-
con.create_table("events", events_df, database=("analytics", "public"), overwrite=True)
96+
con.create_table("events", events_df, database=("analytics", "main"), overwrite=True)
9797

9898
# PyArrow tables also work
9999
import pyarrow as pa
100100
table = pa.table({"id": [1, 2], "name": ["alice", "bob"]})
101-
con.create_table("users", table, database=("analytics", "public"), overwrite=True)
101+
con.create_table("users", table, database=("analytics", "main"), overwrite=True)
102102

103103
# Schema-only (no data): creates an empty table with the declared schema
104104
import ibis.expr.schema as sch
105105
con.create_table(
106106
"staging",
107107
schema=sch.Schema({"id": "int64", "ts": "timestamp"}),
108-
database=("analytics", "public"),
108+
database=("analytics", "main"),
109109
)
110110
```
111111

@@ -116,7 +116,7 @@ Table names must be declared when the database is created — you cannot upload
116116
When querying, use `"default"` as the catalog:
117117

118118
```python
119-
t = con.table("events", database=("default", "public"))
119+
t = con.table("events", database=("default", "main"))
120120

121121
result = (
122122
t.filter(t.event_type == "click")
@@ -131,7 +131,7 @@ Or with raw SQL:
131131
```python
132132
result = con.sql(
133133
'SELECT user_id, COUNT(*) AS n '
134-
'FROM "default"."public"."events" '
134+
'FROM "default"."main"."events" '
135135
'WHERE event_type = \'click\' '
136136
'GROUP BY user_id'
137137
).execute()
@@ -142,8 +142,8 @@ result = con.sql(
142142
Pass `force=True` to silently skip errors when the database or table does not exist:
143143

144144
```python
145-
con.drop_table("events", database=("analytics", "public"))
146-
con.drop_table("events", database=("analytics", "public"), force=True) # no-op if missing
145+
con.drop_table("events", database=("analytics", "main"))
146+
con.drop_table("events", database=("analytics", "main"), force=True) # no-op if missing
147147

148148
con.drop_database("analytics")
149149
con.drop_database("analytics", force=True) # no-op if missing
@@ -161,7 +161,7 @@ con.drop_database("analytics", force=True) # no-op if missing
161161
### Ibis expressions
162162

163163
```python
164-
t = con.table("orders", database=("default", "public"))
164+
t = con.table("orders", database=("default", "main"))
165165

166166
summary = (
167167
t.filter(t.amount > 10)
@@ -178,7 +178,7 @@ summary = (
178178

179179
```python
180180
base = con.sql(
181-
'SELECT * FROM "default"."public"."orders"',
181+
'SELECT * FROM "default"."main"."orders"',
182182
dialect="postgres",
183183
)
184184
result = base.filter(base.amount > 10).execute()

src/ibis_hotdata/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ def create_database(
576576
/,
577577
*,
578578
catalog: str | None = None,
579-
schema: str = "public",
579+
schema: str = "main",
580580
tables: Sequence[str] | None = None,
581581
force: bool = False,
582582
) -> None:

src/ibis_hotdata/http.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
APPLICATION_ARROW_STREAM = "application/vnd.apache.arrow.stream"
3838

3939
# Statuses that mean the query run is still in progress.
40-
_IN_FLIGHT = {"running", "queued", "pending"}
40+
# runtimedb QueryRunStatus only emits "running", "succeeded", "failed".
41+
_IN_FLIGHT = {"running"}
4142

4243

4344
def _sleep_until(deadline: float, interval: float) -> None:

0 commit comments

Comments
 (0)