> ## 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.

# export_records_to_files

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/export_records_to_files.rs#L41-L52)
pub async fn [export\_records\_to\_files](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/export-records-to-files.md#method.export_records_to_files)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), filepath: [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)\<[ExportRecordsToFilesResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Export records from tableExport records from a table to files. All tables can be exported, in full or partial (see columns\_to\_export and columns\_to\_skip). Additional filtering can be applied when using export table with expression through SQL. Default destination is KIFS, though other storage types (Azure, S3, GCS, and HDFS) are supported through datasink\_name; see `/create/datasink`.Server’s local file system is not supported. Default file format is delimited text. See options for different file types and different options for each file type. Table is saved to a single file if within max file size limits (may vary depending on datasink type). If not, then table is split into multiple files; these may be smaller than the max size limit.All filenames created are returned in the response.

##### Arguments

<ul>
  <li>`table_name` - The name of the table whose records are to be exported.</li>
  <li>`filepath` - Path to data export target. If `filepath` has a file extension, it is read as the name of a file. If `filepath` is a directory, then the source table name with a random UUID appended will be used as the name of each exported file, all written to that directory. If filepath is a filename, then all exported files will have a random UUID appended to the given name. In either case, the target directory specified or implied must exist. The names of all exported files are returned in the response.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/export_records_to_files.rs#L85-L103)
pub async fn [export\_records\_to\_files\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/export-records-to-files.md#method.export_records_to_files_with_opts)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), filepath: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), options: [ExportRecordsToFilesRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[ExportRecordsToFilesResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Export records from tableExport records from a table to files. All tables can be exported, in full or partial (see columns\_to\_export and columns\_to\_skip). Additional filtering can be applied when using export table with expression through SQL. Default destination is KIFS, though other storage types (Azure, S3, GCS, and HDFS) are supported through datasink\_name; see `/create/datasink`.Server’s local file system is not supported. Default file format is delimited text. See options for different file types and different options for each file type. Table is saved to a single file if within max file size limits (may vary depending on datasink type). If not, then table is split into multiple files; these may be smaller than the max size limit.All filenames created are returned in the response.

##### Arguments

<ul>
  <li>`table_name` - The name of the table whose records are to be exported.</li>
  <li>`filepath` - Path to data export target. If `filepath` has a file extension, it is read as the name of a file. If `filepath` is a directory, then the source table name with a random UUID appended will be used as the name of each exported file, all written to that directory. If filepath is a filename, then all exported files will have a random UUID appended to the given name. In either case, the target directory specified or implied must exist. The names of all exported files are returned in the response.</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/export_records_to_files.rs#L106-L117)
pub async fn [export\_records\_to\_files\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/export-records-to-files.md#method.export_records_to_files_raw)( \&self, request: &[ExportRecordsToFilesRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[ExportRecordsToFilesResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

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

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/export_records_to_files.rs#L121-L133)
pub async fn [export\_records\_to\_files\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/export-records-to-files.md#method.export_records_to_files_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[ExportRecordsToFilesRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[ExportRecordsToFilesResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`ExportRecordsToFilesRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.ExportRecordsToFilesRequest) 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.