> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# insert_records_from_query

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/insert_records_from_query.rs#L29-L47)
pub async fn [insert\_records\_from\_query](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/insert-records-from-query.md#method.insert_records_from_query)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), remote\_query: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), modify\_columns: [HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>>, create\_table\_options: [HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[InsertRecordsFromQueryResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Insert records from external database from a given query into the specified target tableComputes remote query result and inserts the result data into a new or existing table.

##### Arguments

<ul>
  <li>`table_name` - Name of the table into which the data will be inserted, in \[schema\_name.]table\_name format, using standard name resolution rules. If the table does not exist, the table will be created using either an existing type\_id or the type inferred from the remote query, and the new table name will have to meet standard table naming criteria.</li>
  <li>`remote_query` - Query for which result data needs to be imported.</li>
  <li>`modify_columns` - Not implemented yet.</li>
  <li>`create_table_options` - Options used when creating the target table.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/insert_records_from_query.rs#L68-L93)
pub async fn [insert\_records\_from\_query\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/insert-records-from-query.md#method.insert_records_from_query_with_opts)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), remote\_query: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), modify\_columns: [HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>>, create\_table\_options: [HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, options: [InsertRecordsFromQueryRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[InsertRecordsFromQueryResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Insert records from external database from a given query into the specified target tableComputes remote query result and inserts the result data into a new or existing table.

##### Arguments

<ul>
  <li>`table_name` - Name of the table into which the data will be inserted, in \[schema\_name.]table\_name format, using standard name resolution rules. If the table does not exist, the table will be created using either an existing type\_id or the type inferred from the remote query, and the new table name will have to meet standard table naming criteria.</li>
  <li>`remote_query` - Query for which result data needs to be imported.</li>
  <li>`modify_columns` - Not implemented yet.</li>
  <li>`create_table_options` - Options used when creating the target table.</li>
  <li>`options` - The optional parameters; any left unset take the server’s defaults.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/insert_records_from_query.rs#L96-L107)
pub async fn [insert\_records\_from\_query\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/insert-records-from-query.md#method.insert_records_from_query_raw)( \&self, request: &[InsertRecordsFromQueryRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[InsertRecordsFromQueryResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`InsertRecordsFromQueryRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryRequest) to the `/insert/records/fromquery` endpoint.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/insert_records_from_query.rs#L111-L123)
pub async fn [insert\_records\_from\_query\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/insert-records-from-query.md#method.insert_records_from_query_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[InsertRecordsFromQueryRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[InsertRecordsFromQueryResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`InsertRecordsFromQueryRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.InsertRecordsFromQueryRequest) to a specific worker URL, bypassing HA head-node selection. Used for multi-head access.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.