Merge branch 'master' of https://github.com/sunyinqi0508/AQuery2
This commit is contained in:
@@ -223,6 +223,9 @@ DROP TABLE my_table IF EXISTS
|
|||||||
- File name can also be absolute path.
|
- File name can also be absolute path.
|
||||||
- See `data/q1.sql` for more information
|
- 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:
|
## 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`.
|
- `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.
|
- `var[s]`, `stddev[s]`: [moving/rolling] **population** variance, standard deviation.
|
||||||
|
|||||||
@@ -937,6 +937,7 @@ class filter(ast_node):
|
|||||||
def produce(self, node):
|
def produce(self, node):
|
||||||
filter_expr = expr(self, node)
|
filter_expr = expr(self, node)
|
||||||
self.add(filter_expr.sql)
|
self.add(filter_expr.sql)
|
||||||
|
if self.datasource is not None:
|
||||||
self.datasource.join_conditions += filter_expr.join_conditions
|
self.datasource.join_conditions += filter_expr.join_conditions
|
||||||
|
|
||||||
class create_table(ast_node):
|
class create_table(ast_node):
|
||||||
@@ -1053,6 +1054,18 @@ class insert(ast_node):
|
|||||||
self.sql += ', '.join(list_values)
|
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):
|
class load(ast_node):
|
||||||
name="load"
|
name="load"
|
||||||
first_order = name
|
first_order = name
|
||||||
|
|||||||
Reference in New Issue
Block a user