MCPcopy Create free account
hub / github.com/apache/paimon-rust / test_sql_context_ddl_dml

Function test_sql_context_ddl_dml

bindings/python/tests/test_datafusion.py:48–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47
48def test_sql_context_ddl_dml():
49 with tempfile.TemporaryDirectory() as warehouse:
50 ctx = SQLContext()
51 ctx.register_catalog("paimon", {"warehouse": warehouse})
52
53 ctx.sql("CREATE SCHEMA paimon.test_db")
54 ctx.sql(
55 "CREATE TABLE paimon.test_db.users "
56 "(id INT, name STRING, PRIMARY KEY (id))"
57 )
58
59 ctx.sql("INSERT INTO paimon.test_db.users VALUES (1, 'alice'), (2, 'bob')")
60
61 batches = ctx.sql("SELECT id, name FROM paimon.test_db.users")
62 table = pa.Table.from_batches(batches)
63 rows = sorted(zip(table["id"].to_pylist(), table["name"].to_pylist()))
64 assert rows == [(1, "alice"), (2, "bob")]
65
66 ctx.sql("DROP TABLE paimon.test_db.users")
67 ctx.sql("DROP SCHEMA paimon.test_db")
68
69
70def test_register_batch_fully_qualified():

Callers

nothing calls this directly

Calls 3

register_catalogMethod · 0.95
sqlMethod · 0.95
SQLContextClass · 0.90

Tested by

no test coverage detected