Help Topics for sql

Project

awg

Function

find_cable

Sample CLI

gway awg find-cable

References

['debug', 'info', 'sql', 'sql.open_connection']

Signature

(*, meters: Union[int, str, NoneType] = None, amps: Union[int, str] = '40', volts: Union[int, str] =
'220', material: Literal['cu', 'al', '?'] = 'cu', max_lines: Union[int, str] = '1', phases:
Literal['1', '3', 1, 3] = '1', conduit: Union[str, bool, NoneType] = None, neutral: Union[int, str]
= '1')

Docstring

Calculate the type of cable needed for an electrical system.

Project

awg

Function

find_conduit

Sample CLI

gway awg find-conduit

References

['sql', 'sql.open_connection']

Signature

(awg, cables, *, conduit='emt')

Docstring

Calculate the kind of conduit required for a set of cables.

Project

release

Function

build_help_db

Sample CLI

gway release build-help-db

References

['_builtins', '_builtins.items', 'load_project', 'sql', 'sql.open_connection', 'warning']

Signature

()

Project

sql

Function

close_connection

Sample CLI

gway sql close-connection

References

['info', 'warning']

Signature

(datafile=None, *, sql_engine='sqlite', all=False)

Docstring

Explicitly close one or all cached database connections.

Project

sql

Function

execute

Sample CLI

gway sql execute

References

['info', 'resource']

Signature

(*sql, connection=None, script=None, into=None)

Docstring

Execute SQL code or a script resource. If both are given, run script first. Returns dict with 'data' (rows, if any) and 'sql' (last statement run).

TODOs

# TODO: Implement "into" as a function or the name of a function we can get with # gw[into] if so, for each row we execute in a select, we pass the extracted data as # kwargs by name to the function, then replace row with the result.

Project

sql

Function

infer_type

Sample CLI

gway sql infer-type

References

['infer_type']

Signature

(val)

Project

sql

Function

load_csv

Sample CLI

gway sql load-csv

References

['debug', 'info', 'resource', 'warning']

Signature

(*, connection=None, folder='data', force=False)

Docstring

Recursively loads CSVs from a folder into SQLite tables. Table names are derived from folder/file paths.

Project

sql

Function

open_connection

Sample CLI

gway sql open-connection

References

['debug', 'info', 'resource', 'warning']

Signature

(datafile=None, *, sql_engine='sqlite', autoload=False, force=False, row_factory=False, **dbopts)

Docstring

Initialize or reuse a database connection. Caches connections by sql_engine, file path, and thread ID (if required).

Project

builtin

Function

help

Sample CLI

gway help

References

['info', 'release', 'release.build_help_db', 'resource', 'sql', 'sql.open_connection', 'warning']

Signature

(*args, full=False)