Technical Documentation

This page contains the internal technical documentation of the snowconvert-helpers project, generated automatically by pydoc

Functions

All the functions defined in the project.

access

access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)

Description:

Use the real uid/gid to test for access to a path.

dir_fd, effective_ids, and follow_symlinks may not be implemented on your platform. If they are unavailable, using them will raise a NotImplementedError.

Note that most operations will use the effective uid/gid, therefore this routine can be used in a suid/sgid environment to test if the invoking user has the specified access to the path.

Parameters:

  • path, Path to be tested; can be string, bytes, or a path-like object

  • mode, Operating-system mode bitfield. Can be F_OK to test existence, or the inclusive-OR of R_OK, W_OK, and X_OK

  • dir_fd, If not None, it should be a file descriptor open to a directory, and path should be relative; path will then be relative to that directory

  • effective_ids, If True, access will use the effective uid/gid instead of the real uid/gid

  • follow_symlinks, If False, and the last element of the path is a symbolic link, access will examine the symbolic link itself instead of the file the link points to

at_exit_helpers

at_exit_helpers()

Description:

Executes at the exit of the execution of the script.

colored

colored(text, color='blue')

Description:

Prints colored text from the specified color.

Parameters:

  • text, The text to be printed

  • color="blue", The color to print

configure_log

configure_log(configuration_path)

Description:

Configures the logging that will be performed for any data-related execution on the snowflake connection. The log file is named 'snowflake_python_connector.log' by default.

Parameters:

  • configuration_path, The configuration path of the file that contains all the settings desired for the logging

drop_transient_table

drop_transient_table(tempTableName, con=None)

Description:

Drops the transient table with the specified name.

Parameters:

  • tempTableName, The name of the temporary table

  • con=None, The connection to be used, if None is passed it will use the last connection performed

exception_hook

exception_hook(exctype, value, tback)

Description:

Parameters:

  • exctype

  • value

  • tback

exec

exec(sql_string, using=None, con=None)

Description:

Executes a sql string using the last connection, optionally it uses arguments or an specific connection. Examples:

  • exec("SELECT * FROM USER")

  • exec("SELECT * FROM USER", con)

  • exec("SELECT * FROM CUSTOMER WHERE CUSTOMERID= %S", customer)

Parameters:

  • sql_string, The definition of the sql

  • using=None, The optional parameter that can be used in the sql passed

  • con=None, The connection to be used, if None is passed it will use the last connection performed

exec_file

exec_file(filename, con=None)

Description:

Reads the content of a file and executes the sql statements contained with the specified connection.

Parameters:

  • filename, The filename to be read and executed

  • con=None, The connection to be used, if None is passed it will use the last connection performed

exec_os

exec_os(command)

Description:

Executes a command in the operative system.

exec_sql_statement

exec_sql_statement(sql_string, con, using=None)

Description:

Executes a sql statement in the connection passed, with the optional arguments.

Parameters:

  • sql_string, The sql containing the string to be executed

  • con, The connection to be used

  • using, The optional parameters to be used in the sql execution

expands_using_params

expands_using_params(statement, params)

Description:

Expands the statement passed with the parameters.

Parameters:

  • statement, The sql containing the string to be executed

  • params, The parameters of the sql statement

expandvar

expandvar(str)

Description:

Expands the variable from the string passed.

Parameters:

  • str, The string to be expanded with the variables

expandvars

expandvars(path, params, skip_escaped=False)

Description:

Expand environment variables of form $var and ${var}. If parameter 'skip_escaped' is True, all escaped variable references (i.e. preceded by backslashes) are skipped. Unknown variables are set to 'default'. If 'default' is None, they are left unchanged.

Parameters:

  • path,

  • params,

  • skip_escaped=False,

fast_load

fast_load(target_schema, filepath, stagename, target_table_name, con=None)

Description:

Executes the fast load with the passed parameters target_schema, filepath, stagename and target_table_name.

Parameters:

  • target_schema, The name of the schema to be used in the fast load

  • filepath, The filename path to be loaded in the table

  • target_table_name, The name of the table that will have the data loaded

  • con=None, The connection to be used, if None is passed it will use the last connection performed

file_exists_and_readable

file_exists_and_readable(filename)

Description:

Parameters:

  • filename,

get_argkey

get_argkey(astr)

Description:

Gets the argument key value from the passed string. It must start with the string '--param-'

Parameters:

  • astr, The argument string to be used. The string should have a value similar to --param-column=32 and the returned string will be '32

get_error_position

get_error_position()

Description:

Gets the error position from the file using the information of the stack of the produced error.