File.FileManager (etl_core v0.1.4)

Tools for working with files

Link to this section Summary

Functions

Load JSON into memory

Almacena los datos en un fichero JSON, formato compatible para la carga por lotes en BigQuery. El nombre del fichero coincide la hora de emitido en formato UNIX

Link to this section Functions

Link to this function

load_json(filename)

Load JSON into memory

parameter

Parameter:

- filename: String or String List indicating the path of files in JSON format to read

examples

Examples:

eix> load_json("hello.json")
{word: "world"}

eix> load_json(["hello.txt", "foo.json"])
[{word: "world"}, {key: "bar"}]

eix> filename = "./file.txt" # fake file path
eix> load_json(filename)
{:error, :enoent}

eix> filename = "./file.txt" # misdefined JSON file
eix> load_json(filename)
{:error, %Poison.Parse{...}}
Link to this function

to_json_for_bigquery(data, path \\ ".")

Almacena los datos en un fichero JSON, formato compatible para la carga por lotes en BigQuery. El nombre del fichero coincide la hora de emitido en formato UNIX

Parameters:

- path: String. Local path to store the file.

- data: List of map. Data.

return

Return:

- :ok | Exception