@@ -380,7 +380,40 @@ impl LogicalPlanBuilder {
380380 } ) ) )
381381 }
382382
383- /// Create a [DmlStatement] for inserting the contents of this builder into the named table
383+ /// Create a [DmlStatement] for inserting the contents of this builder into the named table.
384+ ///
385+ /// Note, use a [`DefaultTableSource`] to insert into a [`TableProvider`]
386+ ///
387+ /// [`DefaultTableSource`]: https://docs.rs/datafusion/latest/datafusion/datasource/default_table_source/struct.DefaultTableSource.html
388+ /// [`TableProvider`]: https://docs.rs/datafusion/latest/datafusion/catalog/trait.TableProvider.html
389+ ///
390+ /// # Example:
391+ /// ```
392+ /// # use datafusion_expr::{lit, LogicalPlanBuilder,
393+ /// # logical_plan::builder::LogicalTableSource,
394+ /// # };
395+ /// # use std::sync::Arc;
396+ /// # use arrow::datatypes::{Schema, DataType, Field};
397+ /// # use datafusion_expr::dml::InsertOp;
398+ /// #
399+ /// # fn test() -> datafusion_common::Result<()> {
400+ /// # let employee_schema = Arc::new(Schema::new(vec![
401+ /// # Field::new("id", DataType::Int32, false),
402+ /// # ])) as _;
403+ /// # let table_source = Arc::new(LogicalTableSource::new(employee_schema));
404+ /// // VALUES (1), (2)
405+ /// let input = LogicalPlanBuilder::values(vec![vec![lit(1)], vec![lit(2)]])?
406+ /// .build()?;
407+ /// // INSERT INTO MyTable VALUES (1), (2)
408+ /// let insert_plan = LogicalPlanBuilder::insert_into(
409+ /// input,
410+ /// "MyTable",
411+ /// table_source,
412+ /// InsertOp::Append,
413+ /// )?;
414+ /// # Ok(())
415+ /// # }
416+ /// ```
384417 pub fn insert_into (
385418 input : LogicalPlan ,
386419 table_name : impl Into < TableReference > ,
0 commit comments