AppLib WRITE ROWS TO FILE
From LucidDB Wiki
Contents |
Syntax
FROM TABLE( APPLIB.WRITE_ROWS_TO_FILE ( rows_to_be_written, file, is_compressed ) )
Purpose
Allow serialized rows to be written to a file.
Input
- row_format_cursor [CURSOR]: A cursor that contains the data/format to be written.
- file [VARCHAR]: The URL of the file. There should be support for Java file access (file://, etc) but also resources from the classpath. ie, a file on the classpath at com/company/datafile.ldbrows should also be accessible.
- is_compressed [BOOLEAN]: Determines if the serialized file will be gzip compressed or not.
Output
- status [INT] : 0 for success, 1 for failure (--Jvs 17:41, 12 June 2010 (EDT): but in some cases the UDX may abort with an exception rather than returning a failure message)
- message [VARCHAR] : either a success message with the number of rows written, or an error message
Example
SELECT ROWS_WRITTEN from
TABLE(
APPLIB.WRITE_ROWS_TO_FILE(
CURSOR(
select * from mytable
)
,'file:///tmp/mydatafile.ldbrows'
,true
)
)
See Also
- LucidDbUtilityRowSerialization
- Files can be read back in using LucidDbAppLib_READ_ROWS_FROM_FILE