-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pyspark): add catalog support to pyspark (#9042)
Resolves #9038 Adds support for specifying the `catalog` in various `pyspark` calls. BREAKING CHANGE: Arguments to `create_database`, `drop_database`, and `get_schema` are now keyword-only except for the `name` args. Calls to these functions that have relied on positional argument ordering need to be updated.
- Loading branch information
Showing
4 changed files
with
104 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from __future__ import annotations | ||
|
||
import ibis | ||
|
||
|
||
def test_catalog_db_args(con, monkeypatch): | ||
monkeypatch.setattr(ibis.options, "default_backend", con) | ||
t = ibis.memtable({"epoch": [1712848119, 1712848121, 1712848155]}) | ||
|
||
# create a table in specified catalog and db | ||
con.create_table( | ||
"t2", database=(con.current_catalog, "default"), obj=t, overwrite=True | ||
) | ||
|
||
assert "t2" not in con.list_tables() | ||
assert "t2" in con.list_tables(database="default") | ||
assert "t2" in con.list_tables(database="spark_catalog.default") | ||
assert "t2" in con.list_tables(database=("spark_catalog", "default")) | ||
|
||
con.drop_table("t2", database="spark_catalog.default") | ||
|
||
assert "t2" not in con.list_tables(database="default") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters