MCPcopy Create free account
hub / github.com/apache/datafusion / create_custom_table

Function create_custom_table

datafusion/core/tests/sql/create_drop.rs:24–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22
23#[tokio::test]
24async fn create_custom_table() -> Result<()> {
25 let mut state = SessionStateBuilder::new().with_default_features().build();
26 state
27 .table_factories_mut()
28 .insert("DELTATABLE".to_string(), Arc::new(TestTableFactory {}));
29 let ctx = SessionContext::new_with_state(state);
30
31 let sql = "CREATE EXTERNAL TABLE dt STORED AS DELTATABLE LOCATION 's3://bucket/schema/table';";
32 ctx.sql(sql).await.unwrap();
33
34 let cat = ctx.catalog("datafusion").unwrap();
35 let schema = cat.schema("public").unwrap();
36 let exists = schema.table_exist("dt");
37 assert!(exists, "Table should have been created!");
38
39 Ok(())
40}
41
42#[tokio::test]
43async fn create_external_table_with_ddl() -> Result<()> {

Callers

nothing calls this directly

Calls 10

newFunction · 0.85
with_default_featuresMethod · 0.80
table_factories_mutMethod · 0.80
sqlMethod · 0.80
buildMethod · 0.45
insertMethod · 0.45
to_stringMethod · 0.45
catalogMethod · 0.45
schemaMethod · 0.45
table_existMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…