@@ -30,6 +30,8 @@ pub struct Database {
3030 pub default_catalog : Option < String > ,
3131 pub default_connection_id : String ,
3232 #[ serde( default ) ]
33+ pub expires_at : Option < String > ,
34+ #[ serde( default ) ]
3335 attachments : Vec < DatabaseAttachment > ,
3436}
3537
@@ -653,12 +655,13 @@ pub fn create(
653655 format!(
654656 concat!(
655657 "Load a table:\n " ,
656- " hotdata databases load --file <path.parquet> {}.<table_name>\n " ,
658+ " hotdata databases load --catalog {0} --table <table> --file <path.parquet>\n " ,
659+ " hotdata databases load --catalog {0} --table <table> --url <url>\n " ,
657660 "\n Query with:\n " ,
658- " hotdata query --database {} \" SELECT * FROM {}.public.<table> LIMIT 10\" \n " ,
661+ " hotdata query \" SELECT * FROM {0 }.public.<table> LIMIT 10\" \n " ,
659662 "\n Tip: column names are case-sensitive — wrap uppercase names in double quotes" ,
660663 ) ,
661- result . id , result . id , catalog
664+ catalog
662665 )
663666 . dark_grey( )
664667 ) ;
@@ -823,8 +826,19 @@ pub fn tables_load(
823826 let ( status, resp_body) = if !status. is_success ( )
824827 && crate :: util:: api_error ( resp_body. clone ( ) ) . contains ( "not declared" )
825828 {
826- // The table wasn't declared at create time. Delete the database and
827- // recreate it with the table declared, then retry the load.
829+ // The table wasn't declared at create time. Collect existing tables so
830+ // they are re-declared in the replacement database, then delete and
831+ // recreate with all tables (including the new one) declared.
832+ let existing = collect_tables ( & api, & db. default_connection_id , None ) ;
833+ let mut all_tables: Vec < String > = existing
834+ . iter ( )
835+ . map ( |t| format ! ( "{}.{}" , t. schema, t. table) )
836+ . collect ( ) ;
837+ let new_table_key = format ! ( "{schema}.{table}" ) ;
838+ if !all_tables. contains ( & new_table_key) {
839+ all_tables. push ( new_table_key) ;
840+ }
841+
828842 let ( del_status, del_body) = api. delete_raw ( & format ! ( "/databases/{}" , db. id) ) ;
829843 if !del_status. is_success ( ) {
830844 eprintln ! ( "{}" , crate :: util:: api_error( del_body) . red( ) ) ;
@@ -834,8 +848,8 @@ pub fn tables_load(
834848 db. name . as_deref ( ) ,
835849 db. default_catalog . as_deref ( ) ,
836850 schema,
837- & [ table . to_string ( ) ] ,
838- None ,
851+ & all_tables ,
852+ db . expires_at . as_deref ( ) ,
839853 ) ;
840854 let ( create_status, create_body_resp) = api. post_raw ( "/databases" , & create_body) ;
841855 if !create_status. is_success ( ) {
0 commit comments