Connection.Odbc (etl_core v0.1.55)

Module for working with the ODBC library. It frees you from having to know how Erlang's :odbc library works.

Summary

Functions

Establishes the connection to Data Source

Delete rows from the specified table

Genera un UUID

Inserts an object into the specified table

Create and execute an SQL statement of type `SELECT xx FROM x WHERE xxx. It is assumed that WHERE condition will only have the AND operator. Para ### Parameters: - pid: Process. Process connecting Elixir and ODBC. - statement: String. SQL Statement. ### Return: - list of (list of tuples ({:atom, :string})) | Exception. Fields with null values are ignored.

Start the ODBC application

Stop the ODBC application

Update an object into the specified table. It uses the retry decorator to retry the execution of the statement, in case of a concurrency error issued by BigQuery.

Functions

Link to this function

connect(data_source)

Establishes the connection to Data Source

Parameter:

- data_source: List. Data source information.

Return:

- PID | Exception. If the connection can be established with the parameters defined in the configuration files, process identifier is returned. Otherwise, it throws an exception with the error.
Link to this function

delete(pid, statement)

Delete rows from the specified table

Parameters:

- pid: Process. Process connecting Elixir and ODBC.

- statement: String. SQL Statement.

Return:

- Exception | {:updated, n} where n is the number of records deleted

Genera un UUID

Parameter:

- pid: Process.

Return:

- string | Exception. If the query succeeds, it returns the UUID; otherwise, it raises an exception from `:odbc.sql_query/2` statement.
Link to this function

insert(pid, statement)

Inserts an object into the specified table

Parameters:

- pid: Process. Process connecting Elixir and ODBC.

- statement: String. SQL Statement.

Return:

- {:inserted, 1} | Exception
Link to this function

select(pid, statement)

Create and execute an SQL statement of type `SELECT xx FROM x WHERE xxx. It is assumed that WHERE condition will only have the AND operator. Para ### Parameters: - pid: Process. Process connecting Elixir and ODBC. - statement: String. SQL Statement. ### Return: - list of (list of tuples ({:atom, :string})) | Exception. Fields with null values are ignored.

Start the ODBC application

Return:

- :ok | exception. If the ODBC application has not been started or if it has already been started, return the atom. Otherwise, it throws an exception with the error.

Stop the ODBC application

Return:

- :ok | exception. If the ODBC application has not been stopped or if it has already been stopped, return the atom. Otherwise, it throws an exception with the error.
Link to this function

update(pid, statement)

Update an object into the specified table. It uses the retry decorator to retry the execution of the statement, in case of a concurrency error issued by BigQuery.

Parameters:

- pid: Process. Process connecting Elixir and ODBC.

- statement: String. SQL Statement.

Return:

- Exception | {:updated, n} where n is the number of records updated