SQLCode

class getml.pipeline.SQLCode(code: Sequence[Union[str, SQLString]], dialect: str = 'sqlite3')[source]

Custom class for handling the SQL code of the features generated by the pipeline.

Example:
sql_code = my_pipeline.features.to_sql()

# You can access individual features
# by index.
feature_1_1 = sql_code[0]

# You can also access them by name.
feature_1_10 = sql_code["FEATURE_1_10"]

# You can also type the name of
# a table or column to find all
# features related to that table
# or column.
features = sql_code.find("SOME_TABLE")

# HINT: The generated SQL code always
# escapes table and column names using
# quotation marks. So if you want exact
# matching, you can do this:
features = sql_code.find('"SOME_TABLE"')

Methods

find(keyword)

Returns the SQLCode for all features containing the keyword.

save(fname[, split, remove])

Saves the SQL code to a file.

to_str()

Returns a raw string representation of the SQL code.