Writing an agent or informant to disk with x_write_disk()
can be useful
for keeping data validation intel or table information close at hand for
later retrieval (with x_read_disk()
). By default, any data table that the
agent or informant may have held before being committed to disk will be
expunged. This behavior can be changed by setting keep_tbl
to TRUE
but
this only works in the case where the table is not of the tbl_dbi
or the
tbl_spark
class.
x_write_disk(x, filename, path = NULL, keep_tbl = FALSE, keep_extracts = FALSE)
An agent object of class ptblank_agent
, or, an informant of
class ptblank_informant
.
The filename to create on disk for the agent
or
informant
.
An optional path to which the file should be saved (this is
automatically combined with filename
).
An option to keep a data table that is associated with the
agent or informant (which is the case when the agent, for example, is
created using create_agent(tbl = <data table, ...)
). The default is
FALSE
where the data table is removed before writing to disk. For
database tables of the class tbl_dbi
and for Spark DataFrames
(tbl_spark
) the table is always removed (even if keep_tbl
is set to
TRUE
).
An option to keep any collected extract data for failing
rows. By default, this is FALSE
.
8-1
It is recommended to set a table-reading function for later reuse of the
agent and informant after being read from disk through x_read_disk()
.
This can be done initially with the read_fn
argument of
create_agent()
/create_informant()
or, later, with set_read_fn()
.
Alternatively, we can reintroduce the agent or informant to a data table
with the set_tbl()
function.
Other Object Ops:
remove_read_fn()
,
remove_tbl()
,
set_read_fn()
,
set_tbl()
,
x_read_disk()