()
| 46 | |
| 47 | |
| 48 | def 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 | |
| 70 | def test_register_batch_fully_qualified(): |
nothing calls this directly
no test coverage detected