Bill 2 years ago
commit cec2420ddd

@ -223,6 +223,9 @@ DROP TABLE my_table IF EXISTS
- File name can also be absolute path.
- See `data/q1.sql` for more information
## Delete Data:
- Use a query like `DELETE FROM <table_name> [WHERE <conditions>]` to delete rows from a table that matches the conditions.
## Built-in functions:
- `avg[s]`: average of a column. `avgs(col), avgs(w, col)` is rolling and moving average with window `w` of the column `col`.
- `var[s]`, `stddev[s]`: [moving/rolling] **population** variance, standard deviation.

@ -937,7 +937,8 @@ class filter(ast_node):
def produce(self, node):
filter_expr = expr(self, node)
self.add(filter_expr.sql)
self.datasource.join_conditions += filter_expr.join_conditions
if self.datasource is not None:
self.datasource.join_conditions += filter_expr.join_conditions
class create_table(ast_node):
name = 'create_table'
@ -1052,7 +1053,19 @@ class insert(ast_node):
self.sql += ', '.join(list_values)
class delete_table(ast_node):
name = 'delete'
first_order = name
def init(self, node):
super().init(node)
def produce(self, node):
tbl = node['delete']
self.sql = f'DELETE FROM {tbl} '
if 'where' in node:
self.sql += filter(self, node['where']).sql
class load(ast_node):
name="load"
first_order = name

Loading…
Cancel
Save