getml.pipeline.SQLCode
Custom class for handling the SQL code of the features generated by the pipeline.
PARAMETER | DESCRIPTION |
---|---|
code | The SQL code of the features. |
dialect | The SQL dialect used in the code. Default is 'sqlite3'. |
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"')
Source code in getml/pipeline/sql_code.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
find
Returns the SQLCode for all features containing the keyword.
PARAMETER | DESCRIPTION |
---|---|
keyword | The keyword to be found. TYPE: |
RETURNS | DESCRIPTION |
---|---|
SQLCode | The SQL code for all features containing the keyword. |
Source code in getml/pipeline/sql_code.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
save
Saves the SQL code to a file.
PARAMETER | DESCRIPTION |
---|---|
fname | The name of the file or folder (if TYPE: |
split | If True, the code will be split into multiple files, one for each feature and saved into a folder TYPE: |
remove | If True, the existing SQL files in TYPE: |
Source code in getml/pipeline/sql_code.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
to_str
to_str() -> str
Returns a raw string representation of the SQL code.
RETURNS | DESCRIPTION |
---|---|
str | A raw string representation of the SQL code. |
Source code in getml/pipeline/sql_code.py
181 182 183 184 185 186 187 188 |
|