From 165b743cde33b93869131ca8d92c0e33df96e153 Mon Sep 17 00:00:00 2001 From: Aleksandr Kuzminsky Date: Tue, 15 May 2018 12:17:04 -0700 Subject: [PATCH 1/2] =?UTF-8?q?Bump=20version:=201.5.12=20=E2=86=92=201.5.?= =?UTF-8?q?13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etcdb/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etcdb/__init__.py b/etcdb/__init__.py index 8aea1c7..afc8ac5 100644 --- a/etcdb/__init__.py +++ b/etcdb/__init__.py @@ -22,7 +22,7 @@ __author__ = 'Box TechOps Database Team' __email__ = 'oss@box.com' -__version__ = '1.5.12' +__version__ = '1.5.13' def _split_version(version): diff --git a/setup.cfg b/setup.cfg index f794a6e..b574fa8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.5.12 +current_version = 1.5.13 commit = True tag = False diff --git a/setup.py b/setup.py index a01df24..07de022 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( name='etcdb', - version='1.5.12', + version='1.5.13', description="PEP 249 compatible driver for Etcd", long_description=readme + '\n\n' + history, author="Box TechOps Database Team", From 4839a8695334a83e3bb137eaa5acf076726935f7 Mon Sep 17 00:00:00 2001 From: Aleksandr Kuzminsky Date: Tue, 15 May 2018 15:27:52 -0700 Subject: [PATCH 2/2] parser fixes * Update parsetab.py * Handle empty response from etcd --- .gitignore | 1 + Makefile | 2 + etcdb/eval_expr.py | 11 +- etcdb/execute/dml/select.py | 51 ++++--- etcdb/resultset.py | 2 +- etcdb/sqlparser/parsetab.py | 265 ++++++++++++++++++------------------ requirements_dev.txt | 1 + support/run_func_test.sh | 2 +- 8 files changed, 177 insertions(+), 158 deletions(-) diff --git a/.gitignore b/.gitignore index bf17f1d..1ed4527 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ target/ /vagrant/.vagrant/ /etcdb/sqlparser/parser.out /tests/developement/ +/.pytest_cache/ diff --git a/Makefile b/Makefile index c738f6a..2ea7ed5 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,7 @@ install: clean ## install the package to the active Python's site-packages docker-start: @docker run \ -v $(shell pwd):/etcdb \ + --rm \ -it \ ubuntu:xenial \ /bin/bash -l @@ -110,5 +111,6 @@ docker-start: docker-test-func: @docker run \ -v $(shell pwd):/etcdb \ + --rm \ ubuntu:xenial \ /bin/bash -l /etcdb/support/run_func_test.sh diff --git a/etcdb/eval_expr.py b/etcdb/eval_expr.py index de71c77..ac93052 100644 --- a/etcdb/eval_expr.py +++ b/etcdb/eval_expr.py @@ -17,10 +17,11 @@ class EtcdbFunction(object): :param group: True if the functions is aggregate function :type group: bool :param *args: Arguments to pass to function_name""" - def __init__(self, function_name, group=False, *args): - self._function = function_name - self._group = group - self._args = args + def __init__(self, *args, **kwargs): + + self._function = args[0] + self._group = kwargs.get('group', False) + self._args = args[1:] @property def function(self): @@ -74,7 +75,7 @@ def eval_identifier(row, identifier): pos = columns.index(Column(identifier_strip)) return identifier_strip, data[pos] except ValueError: - raise OperationalError('Unknown identifier %s', identifier_strip) + raise OperationalError('Unknown identifier %s' % identifier_strip) def eval_string(value): diff --git a/etcdb/execute/dml/select.py b/etcdb/execute/dml/select.py index 91554c7..f45d13c 100644 --- a/etcdb/execute/dml/select.py +++ b/etcdb/execute/dml/select.py @@ -1,7 +1,11 @@ """Implement SELECT query.""" import json -from etcdb import OperationalError +import time + +from pyetcd import EtcdException + +from etcdb import OperationalError, InternalError from etcdb.eval_expr import eval_expr, EtcdbFunction from etcdb.execute.dml.insert import get_table_columns from etcdb.log import LOG @@ -59,8 +63,7 @@ def prepare_columns(tree): return columns -def get_row_by_primary_key(etcd_client, db, table, primary_key, # pylint: disable=too-many-arguments - wait=False, wait_index=None): +def get_row_by_primary_key(etcd_client, db, table, primary_key, **kwargs): """ Read row from etcd by its primary key value. @@ -69,25 +72,35 @@ def get_row_by_primary_key(etcd_client, db, table, primary_key, # pylint: disab :param db: :param table: :param primary_key: Primary key value. - :param wait: If True it will wait for a change in the key - :type wait: bool - :param wait_index: When waiting you can specify index to wait for. - :type wait_index: int + :param kwargs: See below. :return: Row :rtype: Row + + :Keyword Arguments: + * **wait** (bool) - If True it will wait for a change in the key. + * **wait_index** (int) - When waiting you can specify index to wait for. """ - key = "/{db}/{tbl}/{pk}".format(db=db, - tbl=table, - pk=primary_key) - kwargs = {} - if wait: - kwargs['wait'] = True - if wait_index: - kwargs['waitIndex'] = wait_index - if kwargs: - etcd_response = etcd_client.read(key, **kwargs) - else: - etcd_response = etcd_client.read(key) + key = "/{db}/{tbl}/{pk}".format( + db=db, + tbl=table, + pk=primary_key + ) + client_kwargs = {} + if 'wait' in kwargs: + client_kwargs['wait'] = kwargs.get('wait') + if 'wait_index' in kwargs: + client_kwargs['waitIndex'] = kwargs.get('wait_index') + etcd_response = None + for i in xrange(30): + try: + etcd_response = etcd_client.read(key, **client_kwargs) + break + except EtcdException as err: + LOG.warning("Retry #%d after error: %s", i, err) + time.sleep(1) + if not etcd_response: + raise InternalError('Failed to get response from etcd') + row = () field_values = json.loads(etcd_response.node['value']) table_columns = get_table_columns(etcd_client, db, table) diff --git a/etcdb/resultset.py b/etcdb/resultset.py index 082b716..9ef6180 100644 --- a/etcdb/resultset.py +++ b/etcdb/resultset.py @@ -178,7 +178,7 @@ def next(self): self._column_position = 0 raise StopIteration() - def __getitem__(self, key): + def __getitem__(self, key): # pylint: disable=inconsistent-return-statements if isinstance(key, int): return self._columns[key] else: diff --git a/etcdb/sqlparser/parsetab.py b/etcdb/sqlparser/parsetab.py index 46f3f5b..b775a67 100644 --- a/etcdb/sqlparser/parsetab.py +++ b/etcdb/sqlparser/parsetab.py @@ -1,11 +1,12 @@ # parsetab.py # This file is automatically generated. Do not edit. +# pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' -_lr_signature = 'leftANDORrightUNOTNUMBER STRING STRING_VALUE GREATER_OR_EQ LESS_OR_EQ N_EQ SELECT VERSION AUTO_INCREMENT CREATE DEFAULT FULL INTEGER KEY NULL PRIMARY SHOW TABLE TABLES VARCHAR NOT DATETIME DATABASE DATABASES USE INT FROM COMMIT WHERE OR AND IS SET AUTOCOMMIT LONGTEXT SMALLINT UNSIGNED BOOL TINYINT UNIQUE NAMES INSERT INTO VALUES DROP LIMIT AS UPDATE COUNT ORDER BY ASC DESC WAIT IF EXISTS DELETE IN AFTERstatement : select_statement\n | show_tables_statement\n | create_table_statement\n | create_database_statement\n | show_databases_statement\n | use_database_statement\n | commit_statement\n | set_statement\n | insert_statement\n | delete_statement\n | drop_database_statement\n | drop_table_statement\n | desc_table_statement\n | update_table_statement\n | wait_statementwait_statement : WAIT select_item_list FROM identifier opt_WHERE opt_AFTERopt_AFTER : opt_AFTER : AFTER NUMBERupdate_table_statement : UPDATE identifier SET col_expr_list opt_WHERE col_expr_list : col_exprcol_expr_list : col_expr_list \',\' col_exprcol_expr : identifier \'=\' exprdesc_table_statement : DESC identifierdrop_database_statement : DROP DATABASE identifierdrop_table_statement : DROP TABLE identifier opt_IF_EXISTSopt_IF_EXISTS : opt_IF_EXISTS : IF EXISTSinsert_statement : INSERT INTO identifier opt_fieldlist VALUES \'(\' values_list \')\'opt_fieldlist : opt_fieldlist : \'(\' fieldlist \')\'fieldlist : identifierfieldlist : fieldlist \',\' identifier values_list : valuevalues_list : values_list \',\' valueset_statement : set_autocommit_statement\n | set_names_statementset_names_statement : SET NAMES STRINGset_autocommit_statement : SET AUTOCOMMIT \'=\' NUMBERcommit_statement : COMMITcreate_table_statement : CREATE TABLE identifier \'(\' create_definition_list \')\'create_database_statement : CREATE DATABASE identifiershow_databases_statement : SHOW DATABASESuse_database_statement : USE identifieridentifier : STRINGidentifier : \'`\' STRING \'`\'create_definition_list : create_definitioncreate_definition_list : create_definition_list \',\' create_definitioncreate_definition : identifier column_definitioncolumn_definition : data_type opt_column_def_options_listdata_type : INTEGER opt_UNSIGNED\n | VARCHAR \'(\' NUMBER \')\'\n | DATETIME\n | DATETIME \'(\' NUMBER \')\'\n | INT opt_UNSIGNED\n | LONGTEXT\n | SMALLINT opt_UNSIGNED\n | TINYINT\n | BOOLopt_UNSIGNED :\n | UNSIGNEDopt_column_def_options_list : opt_column_def_options_list : opt_column_def_options opt_column_def_options_listopt_column_def_options : DEFAULT valueopt_column_def_options : NULLopt_column_def_options : NOT NULLopt_column_def_options : AUTO_INCREMENTopt_column_def_options : PRIMARY KEYopt_column_def_options : UNIQUEvalue : q_STRING\n | NUMBER\n | STRING_VALUE q_STRING : "\'" STRING "\'" q_STRING : select_statement : SELECT select_item_list opt_FROM opt_WHERE opt_ORDER_BY opt_LIMITopt_ORDER_BY : opt_ORDER_BY : ORDER BY identifier opt_ORDER_DIRECTIONopt_ORDER_BY : ORDER BY identifier \'.\' identifier opt_ORDER_DIRECTIONopt_ORDER_DIRECTION : opt_ORDER_DIRECTION : ASC\n | DESC opt_LIMIT : opt_LIMIT : LIMIT NUMBERshow_tables_statement : SHOW opt_FULL TABLESopt_FROM : opt_FROM : FROM table_referencetable_reference : identifiertable_reference : identifier \'.\' identifieropt_FULL : opt_FULL : FULLselect_item_list : select_item select_item_list : select_item_list \',\' select_item select_item_list : \'*\'select_item : select_item2 select_aliasselect_item2 : table_wild\n | expr select_alias : select_alias : AS identifiertable_wild : identifier \'.\' \'*\' opt_WHERE : opt_WHERE : WHERE exprexpr : expr OR exprexpr : expr AND exprexpr : NOT expr %prec UNOTexpr : boolean_primaryboolean_primary : boolean_primary IS NULLboolean_primary : boolean_primary IS NOT NULLboolean_primary : boolean_primary comparison_operator predicateboolean_primary : predicatecomparison_operator : \'=\'\n | GREATER_OR_EQ\n | \'>\'\n | LESS_OR_EQ\n | \'<\'\n | N_EQpredicate : bit_expr predicate : bit_expr IN \'(\' list_expr \')\'list_expr : exprlist_expr : list_expr \',\' exprbit_expr : simple_exprsimple_expr : identifiersimple_expr : identifier \'.\' identifiersimple_expr : \'(\' expr \')\'simple_expr : variablevariable : \'@\' \'@\' STRINGsimple_expr : literalliteral : q_STRING\n | NUMBER\n | STRING_VALUEsimple_expr : function_callfunction_call : VERSION \'(\' \')\'function_call : COUNT \'(\' \'*\' \')\'delete_statement : DELETE FROM identifier opt_WHERE' +_lr_signature = 'leftANDORrightUNOTAFTER AND AS ASC AUTOCOMMIT AUTO_INCREMENT BOOL BY COMMIT COUNT CREATE DATABASE DATABASES DATETIME DEFAULT DELETE DESC DROP EXISTS FROM FULL GREATER_OR_EQ IF IN INSERT INT INTEGER INTO IS KEY LESS_OR_EQ LIMIT LONGTEXT NAMES NOT NULL NUMBER N_EQ OR ORDER PRIMARY SELECT SET SHOW SMALLINT STRING STRING_VALUE TABLE TABLES TINYINT UNIQUE UNSIGNED UPDATE USE VALUES VARCHAR VERSION WAIT WHEREstatement : select_statement\n | show_tables_statement\n | create_table_statement\n | create_database_statement\n | show_databases_statement\n | use_database_statement\n | commit_statement\n | set_statement\n | insert_statement\n | delete_statement\n | drop_database_statement\n | drop_table_statement\n | desc_table_statement\n | update_table_statement\n | wait_statementwait_statement : WAIT select_item_list FROM identifier opt_WHERE opt_AFTERopt_AFTER : opt_AFTER : AFTER NUMBERupdate_table_statement : UPDATE identifier SET col_expr_list opt_WHERE col_expr_list : col_exprcol_expr_list : col_expr_list \',\' col_exprcol_expr : identifier \'=\' exprdesc_table_statement : DESC identifierdrop_database_statement : DROP DATABASE identifierdrop_table_statement : DROP TABLE identifier opt_IF_EXISTSopt_IF_EXISTS : opt_IF_EXISTS : IF EXISTSinsert_statement : INSERT INTO identifier opt_fieldlist VALUES \'(\' values_list \')\'opt_fieldlist : opt_fieldlist : \'(\' fieldlist \')\'fieldlist : identifierfieldlist : fieldlist \',\' identifier values_list : valuevalues_list : values_list \',\' valueset_statement : set_autocommit_statement\n | set_names_statementset_names_statement : SET NAMES STRINGset_autocommit_statement : SET AUTOCOMMIT \'=\' NUMBERcommit_statement : COMMITcreate_table_statement : CREATE TABLE identifier \'(\' create_definition_list \')\'create_database_statement : CREATE DATABASE identifiershow_databases_statement : SHOW DATABASESuse_database_statement : USE identifieridentifier : STRINGidentifier : \'`\' STRING \'`\'create_definition_list : create_definitioncreate_definition_list : create_definition_list \',\' create_definitioncreate_definition : identifier column_definitioncolumn_definition : data_type opt_column_def_options_listdata_type : INTEGER opt_UNSIGNED\n | VARCHAR \'(\' NUMBER \')\'\n | DATETIME\n | DATETIME \'(\' NUMBER \')\'\n | INT opt_UNSIGNED\n | LONGTEXT\n | SMALLINT opt_UNSIGNED\n | TINYINT\n | BOOLopt_UNSIGNED :\n | UNSIGNEDopt_column_def_options_list : opt_column_def_options_list : opt_column_def_options opt_column_def_options_listopt_column_def_options : DEFAULT valueopt_column_def_options : NULLopt_column_def_options : NOT NULLopt_column_def_options : AUTO_INCREMENTopt_column_def_options : PRIMARY KEYopt_column_def_options : UNIQUEvalue : q_STRING\n | NUMBER\n | STRING_VALUE q_STRING : "\'" STRING "\'" q_STRING : select_statement : SELECT select_item_list opt_FROM opt_WHERE opt_ORDER_BY opt_LIMITopt_ORDER_BY : opt_ORDER_BY : ORDER BY identifier opt_ORDER_DIRECTIONopt_ORDER_BY : ORDER BY identifier \'.\' identifier opt_ORDER_DIRECTIONopt_ORDER_DIRECTION : opt_ORDER_DIRECTION : ASC\n | DESC opt_LIMIT : opt_LIMIT : LIMIT NUMBERshow_tables_statement : SHOW opt_FULL TABLESopt_FROM : opt_FROM : FROM table_referencetable_reference : identifiertable_reference : identifier \'.\' identifieropt_FULL : opt_FULL : FULLselect_item_list : select_item select_item_list : select_item_list \',\' select_item select_item_list : \'*\'select_item : select_item2 select_aliasselect_item2 : table_wild\n | expr select_alias : select_alias : AS identifiertable_wild : identifier \'.\' \'*\' opt_WHERE : opt_WHERE : WHERE exprexpr : expr OR exprexpr : expr AND exprexpr : NOT expr %prec UNOTexpr : boolean_primaryboolean_primary : boolean_primary IS NULLboolean_primary : boolean_primary IS NOT NULLboolean_primary : boolean_primary comparison_operator predicateboolean_primary : predicatecomparison_operator : \'=\'\n | GREATER_OR_EQ\n | \'>\'\n | LESS_OR_EQ\n | \'<\'\n | N_EQpredicate : bit_expr predicate : bit_expr IN \'(\' list_expr \')\'list_expr : exprlist_expr : list_expr \',\' exprbit_expr : simple_exprsimple_expr : identifiersimple_expr : identifier \'.\' identifiersimple_expr : \'(\' expr \')\'simple_expr : variablevariable : \'@\' \'@\' STRINGsimple_expr : literalliteral : q_STRING\n | NUMBER\n | STRING_VALUEsimple_expr : function_callfunction_call : VERSION \'(\' \')\'function_call : COUNT \'(\' \'*\' \')\'delete_statement : DELETE FROM identifier opt_WHERE' _lr_action_items = {'USE':([0,],[1,]),'*':([6,17,73,96,],[44,44,110,128,]),'DEFAULT':([117,169,171,172,173,174,175,177,178,184,186,188,193,194,196,197,198,199,203,205,206,216,217,218,222,223,],[-72,-59,198,-55,-52,-57,-58,-59,-59,-71,-70,-69,-60,-56,-68,198,-73,-66,-64,-50,-54,-63,-67,-65,-51,-53,]),'AUTOCOMMIT':([7,],[58,]),'DATABASES':([19,],[66,]),'NUMBER':([6,17,54,55,76,79,81,82,83,84,85,86,91,92,97,115,121,157,160,163,166,179,195,198,204,209,],[37,37,37,37,37,-114,-110,-113,-112,-109,37,-111,37,37,130,37,37,37,186,189,37,207,214,186,219,186,]),'UNSIGNED':([169,177,178,],[193,193,193,]),'TINYINT':([33,107,152,],[-44,-45,174,]),'SMALLINT':([33,107,152,],[-44,-45,169,]),'LIMIT':([6,33,37,38,39,40,41,43,44,45,46,47,48,49,51,52,53,55,56,57,76,77,79,81,82,83,84,85,86,89,91,92,94,95,107,111,112,113,114,115,116,117,119,120,122,123,124,125,126,128,129,142,144,145,147,161,165,190,210,212,213,221,224,],[-73,-44,-127,-129,-119,-84,-128,-94,-92,-126,-104,-115,-108,-125,-123,-96,-95,-73,-90,-120,-73,-99,-114,-110,-113,-112,-109,-73,-111,-93,-73,-73,-120,-103,-45,-124,-86,-85,-91,-73,-75,-72,-105,-107,-130,-97,-102,-101,-122,-98,-121,-131,-100,163,-106,-87,-116,-78,-76,-79,-80,-78,-77,]),'IF':([33,101,107,],[-44,133,-45,]),'N_EQ':([6,17,33,37,38,39,41,45,46,47,48,49,51,54,55,57,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,119,120,121,122,126,129,142,147,157,165,166,],[-73,-73,-44,-127,-129,-119,-128,-126,79,-115,-108,-125,-123,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-105,-107,-73,-130,-122,-121,-131,-106,-73,-116,-73,]),'ORDER':([6,33,37,38,39,40,41,43,44,45,46,47,48,49,51,52,53,55,56,57,76,77,79,81,82,83,84,85,86,89,91,92,94,95,107,111,112,113,114,115,116,117,119,120,122,123,124,125,126,128,129,142,144,147,161,165,],[-73,-44,-127,-129,-119,-84,-128,-94,-92,-126,-104,-115,-108,-125,-123,-96,-95,-73,-90,-120,-73,-99,-114,-110,-113,-112,-109,-73,-111,-93,-73,-73,-120,-103,-45,-124,-86,-85,-91,-73,146,-72,-105,-107,-130,-97,-102,-101,-122,-98,-121,-131,-100,-106,-87,-116,]),'SELECT':([0,],[6,]),'IS':([6,17,33,37,38,39,41,45,46,47,48,49,51,54,55,57,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,119,120,121,122,126,129,142,147,157,165,166,],[-73,-73,-44,-127,-129,-119,-128,-126,80,-115,-108,-125,-123,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-105,-107,-73,-130,-122,-121,-131,-106,-73,-116,-73,]),'INSERT':([0,],[4,]),'TABLE':([10,11,],[61,62,]),'SET':([0,33,69,107,],[7,-44,105,-45,]),'VARCHAR':([33,107,152,],[-44,-45,170,]),'STRING_VALUE':([6,17,54,55,76,79,81,82,83,84,85,86,91,92,115,121,157,160,166,198,209,],[41,41,41,41,41,-114,-110,-113,-112,-109,41,-111,41,41,41,41,41,184,41,184,184,]),"'":([6,17,54,55,76,78,79,81,82,83,84,85,86,91,92,115,121,157,160,166,198,209,],[42,42,42,42,42,117,-114,-110,-113,-112,-109,42,-111,42,42,42,42,42,42,42,42,42,]),')':([33,37,38,39,41,45,46,47,48,49,51,54,55,79,81,82,83,84,85,86,88,91,92,93,94,95,107,110,111,117,119,120,121,122,124,125,126,129,139,140,142,147,148,149,150,151,160,165,166,169,171,172,173,174,175,176,177,178,183,184,185,186,187,188,191,192,193,194,196,197,198,199,201,203,205,206,209,214,215,216,217,218,219,220,222,223,],[-44,-127,-129,-119,-128,-126,-104,-115,-108,-125,-123,-73,-73,-114,-110,-113,-112,-109,-73,-111,122,-73,-73,126,-120,-103,-45,142,-124,-72,-105,-107,-73,-130,-102,-101,-122,-121,158,-31,-131,-106,165,-117,167,-46,-73,-116,-73,-59,-61,-55,-52,-57,-58,-48,-59,-59,-32,-71,-33,-70,208,-69,-118,-47,-60,-56,-68,-61,-73,-66,-49,-64,-50,-54,-73,222,-62,-63,-67,-65,223,-34,-51,-53,]),'(':([6,17,33,35,50,54,55,72,76,79,81,82,83,84,85,86,87,91,92,100,107,115,121,141,157,166,170,173,],[54,54,-44,73,88,54,54,108,54,-114,-110,-113,-112,-109,54,-111,121,54,54,131,-45,54,54,160,54,54,195,204,]),'CREATE':([0,],[10,]),'DROP':([0,],[11,]),'NULL':([80,117,118,169,171,172,173,174,175,177,178,184,186,188,193,194,196,197,198,199,202,203,205,206,216,217,218,222,223,],[119,-72,147,-59,203,-55,-52,-57,-58,-59,-59,-71,-70,-69,-60,-56,-68,203,-73,-66,218,-64,-50,-54,-63,-67,-65,-51,-53,]),',':([6,17,33,37,38,39,40,41,43,44,45,46,47,48,49,51,52,53,55,56,57,64,76,79,81,82,83,84,85,86,89,91,92,94,95,107,111,114,117,119,120,121,122,123,124,125,126,128,129,135,137,139,140,142,147,148,149,150,151,157,160,165,166,169,171,172,173,174,175,176,177,178,181,182,183,184,185,186,187,188,191,192,193,194,196,197,198,199,201,203,205,206,209,215,216,217,218,220,222,223,],[-73,-73,-44,-127,-129,-119,76,-128,-94,-92,-126,-104,-115,-108,-125,-123,-96,-95,-73,-90,-120,76,-73,-114,-110,-113,-112,-109,-73,-111,-93,-73,-73,-120,-103,-45,-124,-91,-72,-105,-107,-73,-130,-97,-102,-101,-122,-98,-121,155,-20,159,-31,-131,-106,166,-117,168,-46,-73,-73,-116,-73,-59,-61,-55,-52,-57,-58,-48,-59,-59,-21,-22,-32,-71,-33,-70,209,-69,-118,-47,-60,-56,-68,-61,-73,-66,-49,-64,-50,-54,-73,-62,-63,-67,-65,-34,-51,-53,]),'.':([33,57,94,107,112,190,],[-44,96,127,-45,143,211,]),'ASC':([33,107,190,221,],[-44,-45,212,212,]),'NAMES':([7,],[59,]),'COMMIT':([0,],[20,]),'WAIT':([0,],[17,]),'=':([6,17,33,37,38,39,41,45,46,47,48,49,51,54,55,57,58,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,119,120,121,122,126,129,136,142,147,157,165,166,],[-73,-73,-44,-127,-129,-119,-128,-126,84,-115,-108,-125,-123,-73,-73,-120,97,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-105,-107,-73,-130,-122,-121,157,-131,-106,-73,-116,-73,]),'<':([6,17,33,37,38,39,41,45,46,47,48,49,51,54,55,57,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,119,120,121,122,126,129,142,147,157,165,166,],[-73,-73,-44,-127,-129,-119,-128,-126,82,-115,-108,-125,-123,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-105,-107,-73,-130,-122,-121,-131,-106,-73,-116,-73,]),'$end':([2,3,5,6,8,9,12,13,14,15,16,18,20,21,22,23,24,27,28,29,32,33,37,38,39,40,41,43,44,45,46,47,48,49,51,52,53,55,56,57,66,68,76,77,79,81,82,83,84,85,86,89,91,92,94,95,98,99,101,102,104,106,107,111,112,113,114,115,116,117,119,120,122,123,124,125,126,128,129,130,132,134,135,137,138,142,144,145,147,153,154,156,157,161,162,165,167,180,181,182,189,190,207,208,210,212,213,221,224,],[-7,-2,-36,-73,-11,-4,-14,-10,-5,0,-8,-13,-39,-15,-1,-12,-9,-35,-6,-3,-43,-44,-127,-129,-119,-84,-128,-94,-92,-126,-104,-115,-108,-125,-123,-96,-95,-73,-90,-120,-42,-23,-73,-99,-114,-110,-113,-112,-109,-73,-111,-93,-73,-73,-120,-103,-37,-41,-26,-24,-83,-99,-45,-124,-86,-85,-91,-73,-75,-72,-105,-107,-130,-97,-102,-101,-122,-98,-121,-38,-25,-99,-99,-20,-132,-131,-100,-81,-106,-27,-17,-19,-73,-87,-74,-116,-40,-16,-21,-22,-82,-78,-18,-28,-76,-79,-80,-78,-77,]),'COUNT':([6,17,54,55,76,79,81,82,83,84,85,86,91,92,115,121,157,166,],[35,35,35,35,35,-114,-110,-113,-112,-109,35,-111,35,35,35,35,35,35,]),'@':([6,17,36,54,55,76,79,81,82,83,84,85,86,91,92,115,121,157,166,],[36,36,74,36,36,36,-114,-110,-113,-112,-109,36,-111,36,36,36,36,36,36,]),'FULL':([19,],[67,]),'STRING':([1,6,17,25,26,31,34,42,54,55,59,60,61,62,63,70,74,75,76,79,81,82,83,84,85,86,90,91,92,96,103,105,108,115,121,127,131,143,155,157,159,164,166,168,211,],[33,33,33,33,33,71,33,78,33,33,98,33,33,33,33,33,111,33,33,-114,-110,-113,-112,-109,33,-111,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,]),'EXISTS':([133,],[153,]),'SHOW':([0,],[19,]),'INTO':([4,],[34,]),'BY':([146,],[164,]),'UPDATE':([0,],[26,]),'DATETIME':([33,107,152,],[-44,-45,173,]),'AS':([6,17,33,37,38,39,41,43,45,46,47,48,49,51,52,53,55,57,76,79,81,82,83,84,85,86,91,92,94,95,107,111,117,119,120,122,124,125,126,128,129,142,147,165,],[-73,-73,-44,-127,-129,-119,-128,-94,-126,-104,-115,-108,-125,-123,90,-95,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-103,-45,-124,-72,-105,-107,-130,-102,-101,-122,-98,-121,-131,-106,-116,]),'VERSION':([6,17,54,55,76,79,81,82,83,84,85,86,91,92,115,121,157,166,],[50,50,50,50,50,-114,-110,-113,-112,-109,50,-111,50,50,50,50,50,50,]),'LESS_OR_EQ':([6,17,33,37,38,39,41,45,46,47,48,49,51,54,55,57,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,119,120,121,122,126,129,142,147,157,165,166,],[-73,-73,-44,-127,-129,-119,-128,-126,83,-115,-108,-125,-123,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-105,-107,-73,-130,-122,-121,-131,-106,-73,-116,-73,]),'IN':([6,17,33,37,38,39,41,45,47,49,51,54,55,57,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,121,122,126,129,142,157,166,],[-73,-73,-44,-127,-129,-119,-128,-126,87,-125,-123,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-73,-130,-122,-121,-131,-73,-73,]),'UNIQUE':([117,169,171,172,173,174,175,177,178,184,186,188,193,194,196,197,198,199,203,205,206,216,217,218,222,223,],[-72,-59,196,-55,-52,-57,-58,-59,-59,-71,-70,-69,-60,-56,-68,196,-73,-66,-64,-50,-54,-63,-67,-65,-51,-53,]),'WHERE':([6,33,37,38,39,40,41,43,44,45,46,47,48,49,51,52,53,55,56,57,76,77,79,81,82,83,84,85,86,89,91,92,94,95,106,107,111,112,113,114,117,119,120,122,123,124,125,126,128,129,134,135,137,142,147,157,161,165,181,182,],[-73,-44,-127,-129,-119,-84,-128,-94,-92,-126,-104,-115,-108,-125,-123,-96,-95,-73,-90,-120,-73,115,-114,-110,-113,-112,-109,-73,-111,-93,-73,-73,-120,-103,115,-45,-124,-86,-85,-91,-72,-105,-107,-130,-97,-102,-101,-122,-98,-121,115,115,-20,-131,-106,-73,-87,-116,-21,-22,]),'DESC':([0,33,107,190,221,],[25,-44,-45,213,213,]),'AND':([6,17,33,37,38,39,41,45,46,47,48,49,51,53,54,55,57,76,79,81,82,83,84,85,86,91,92,93,94,95,107,111,115,117,119,120,121,122,124,125,126,129,142,144,147,149,157,165,166,182,191,],[-73,-73,-44,-127,-129,-119,-128,-126,-104,-115,-108,-125,-123,91,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,91,-120,-103,-45,-124,-73,-72,-105,-107,-73,-130,-102,-101,-122,-121,-131,91,-106,91,-73,-116,-73,91,91,]),'`':([1,6,17,25,26,34,54,55,60,61,62,63,70,71,75,76,79,81,82,83,84,85,86,90,91,92,96,103,105,108,115,121,127,131,143,155,157,159,164,166,168,211,],[31,31,31,31,31,31,31,31,31,31,31,31,31,107,31,31,-114,-110,-113,-112,-109,31,-111,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,]),'GREATER_OR_EQ':([6,17,33,37,38,39,41,45,46,47,48,49,51,54,55,57,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,119,120,121,122,126,129,142,147,157,165,166,],[-73,-73,-44,-127,-129,-119,-128,-126,81,-115,-108,-125,-123,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-105,-107,-73,-130,-122,-121,-131,-106,-73,-116,-73,]),'FROM':([6,17,30,33,37,38,39,40,41,43,44,45,46,47,48,49,51,52,53,55,56,57,64,76,79,81,82,83,84,85,86,89,91,92,94,95,107,111,114,117,119,120,122,123,124,125,126,128,129,142,147,165,],[-73,-73,70,-44,-127,-129,-119,75,-128,-94,-92,-126,-104,-115,-108,-125,-123,-96,-95,-73,-90,-120,103,-73,-114,-110,-113,-112,-109,-73,-111,-93,-73,-73,-120,-103,-45,-124,-91,-72,-105,-107,-130,-97,-102,-101,-122,-98,-121,-131,-106,-116,]),'DATABASE':([10,11,],[60,63,]),'INT':([33,107,152,],[-44,-45,178,]),'INTEGER':([33,107,152,],[-44,-45,177,]),'TABLES':([19,65,67,],[-88,104,-89,]),'LONGTEXT':([33,107,152,],[-44,-45,172,]),'PRIMARY':([117,169,171,172,173,174,175,177,178,184,186,188,193,194,196,197,198,199,203,205,206,216,217,218,222,223,],[-72,-59,200,-55,-52,-57,-58,-59,-59,-71,-70,-69,-60,-56,-68,200,-73,-66,-64,-50,-54,-63,-67,-65,-51,-53,]),'AFTER':([33,37,38,39,41,45,46,47,48,49,51,55,79,81,82,83,84,85,86,91,92,94,95,107,111,115,117,119,120,122,124,125,126,129,134,142,144,147,154,165,],[-44,-127,-129,-119,-128,-126,-104,-115,-108,-125,-123,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-103,-45,-124,-73,-72,-105,-107,-130,-102,-101,-122,-121,-99,-131,-100,-106,179,-116,]),'BOOL':([33,107,152,],[-44,-45,175,]),'KEY':([200,],[217,]),'VALUES':([33,72,107,109,158,],[-44,-29,-45,141,-30,]),'AUTO_INCREMENT':([117,169,171,172,173,174,175,177,178,184,186,188,193,194,196,197,198,199,203,205,206,216,217,218,222,223,],[-72,-59,199,-55,-52,-57,-58,-59,-59,-71,-70,-69,-60,-56,-68,199,-73,-66,-64,-50,-54,-63,-67,-65,-51,-53,]),'NOT':([6,17,54,55,76,80,91,92,115,117,121,157,166,169,171,172,173,174,175,177,178,184,186,188,193,194,196,197,198,199,203,205,206,216,217,218,222,223,],[55,55,55,55,55,118,55,55,55,-72,55,55,55,-59,202,-55,-52,-57,-58,-59,-59,-71,-70,-69,-60,-56,-68,202,-73,-66,-64,-50,-54,-63,-67,-65,-51,-53,]),'>':([6,17,33,37,38,39,41,45,46,47,48,49,51,54,55,57,76,79,81,82,83,84,85,86,91,92,94,107,111,115,117,119,120,121,122,126,129,142,147,157,165,166,],[-73,-73,-44,-127,-129,-119,-128,-126,86,-115,-108,-125,-123,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,-120,-45,-124,-73,-72,-105,-107,-73,-130,-122,-121,-131,-106,-73,-116,-73,]),'OR':([6,17,33,37,38,39,41,45,46,47,48,49,51,53,54,55,57,76,79,81,82,83,84,85,86,91,92,93,94,95,107,111,115,117,119,120,121,122,124,125,126,129,142,144,147,149,157,165,166,182,191,],[-73,-73,-44,-127,-129,-119,-128,-126,-104,-115,-108,-125,-123,92,-73,-73,-120,-73,-114,-110,-113,-112,-109,-73,-111,-73,-73,92,-120,-103,-45,-124,-73,-72,-105,-107,-73,-130,-102,-101,-122,-121,-131,92,-106,92,-73,-116,-73,92,92,]),'DELETE':([0,],[30,]),} @@ -26,136 +27,136 @@ del _lr_goto_items _lr_productions = [ ("S' -> statement","S'",1,None,None,None), - ('statement -> select_statement','statement',1,'p_statement','parser.py',17), - ('statement -> show_tables_statement','statement',1,'p_statement','parser.py',18), - ('statement -> create_table_statement','statement',1,'p_statement','parser.py',19), - ('statement -> create_database_statement','statement',1,'p_statement','parser.py',20), - ('statement -> show_databases_statement','statement',1,'p_statement','parser.py',21), - ('statement -> use_database_statement','statement',1,'p_statement','parser.py',22), - ('statement -> commit_statement','statement',1,'p_statement','parser.py',23), - ('statement -> set_statement','statement',1,'p_statement','parser.py',24), - ('statement -> insert_statement','statement',1,'p_statement','parser.py',25), - ('statement -> delete_statement','statement',1,'p_statement','parser.py',26), - ('statement -> drop_database_statement','statement',1,'p_statement','parser.py',27), - ('statement -> drop_table_statement','statement',1,'p_statement','parser.py',28), - ('statement -> desc_table_statement','statement',1,'p_statement','parser.py',29), - ('statement -> update_table_statement','statement',1,'p_statement','parser.py',30), - ('statement -> wait_statement','statement',1,'p_statement','parser.py',31), + ('statement -> select_statement','statement',1,'p_statement','parser.py',18), + ('statement -> show_tables_statement','statement',1,'p_statement','parser.py',19), + ('statement -> create_table_statement','statement',1,'p_statement','parser.py',20), + ('statement -> create_database_statement','statement',1,'p_statement','parser.py',21), + ('statement -> show_databases_statement','statement',1,'p_statement','parser.py',22), + ('statement -> use_database_statement','statement',1,'p_statement','parser.py',23), + ('statement -> commit_statement','statement',1,'p_statement','parser.py',24), + ('statement -> set_statement','statement',1,'p_statement','parser.py',25), + ('statement -> insert_statement','statement',1,'p_statement','parser.py',26), + ('statement -> delete_statement','statement',1,'p_statement','parser.py',27), + ('statement -> drop_database_statement','statement',1,'p_statement','parser.py',28), + ('statement -> drop_table_statement','statement',1,'p_statement','parser.py',29), + ('statement -> desc_table_statement','statement',1,'p_statement','parser.py',30), + ('statement -> update_table_statement','statement',1,'p_statement','parser.py',31), + ('statement -> wait_statement','statement',1,'p_statement','parser.py',32), ('wait_statement -> WAIT select_item_list FROM identifier opt_WHERE opt_AFTER','wait_statement',6,'p_wait_statement','parser.py',38), - ('opt_AFTER -> ','opt_AFTER',0,'p_opt_after_empty','parser.py',47), - ('opt_AFTER -> AFTER NUMBER','opt_AFTER',2,'p_opt_after','parser.py',51), - ('update_table_statement -> UPDATE identifier SET col_expr_list opt_WHERE','update_table_statement',5,'p_update_table_statement','parser.py',56), - ('col_expr_list -> col_expr','col_expr_list',1,'p_col_expr_list_one','parser.py',63), - ('col_expr_list -> col_expr_list , col_expr','col_expr_list',3,'p_col_expr_list','parser.py',68), - ('col_expr -> identifier = expr','col_expr',3,'p_col_expr','parser.py',74), - ('desc_table_statement -> DESC identifier','desc_table_statement',2,'p_desc_table_statement','parser.py',79), - ('drop_database_statement -> DROP DATABASE identifier','drop_database_statement',3,'p_drop_database_statement','parser.py',85), - ('drop_table_statement -> DROP TABLE identifier opt_IF_EXISTS','drop_table_statement',4,'p_drop_table_statement','parser.py',91), - ('opt_IF_EXISTS -> ','opt_IF_EXISTS',0,'p_opt_if_exists_empty','parser.py',98), - ('opt_IF_EXISTS -> IF EXISTS','opt_IF_EXISTS',2,'p_opt_if_exists','parser.py',103), - ('insert_statement -> INSERT INTO identifier opt_fieldlist VALUES ( values_list )','insert_statement',8,'p_insert_statement','parser.py',108), - ('opt_fieldlist -> ','opt_fieldlist',0,'p_opt_fieldlist_empty','parser.py',124), - ('opt_fieldlist -> ( fieldlist )','opt_fieldlist',3,'p_opt_fieldlist','parser.py',129), - ('fieldlist -> identifier','fieldlist',1,'p_fieldlist_one','parser.py',134), - ('fieldlist -> fieldlist , identifier','fieldlist',3,'p_fieldlist_many','parser.py',139), - ('values_list -> value','values_list',1,'p_values_list_one','parser.py',148), - ('values_list -> values_list , value','values_list',3,'p_values_list_many','parser.py',153), - ('set_statement -> set_autocommit_statement','set_statement',1,'p_set_statement','parser.py',162), - ('set_statement -> set_names_statement','set_statement',1,'p_set_statement','parser.py',163), - ('set_names_statement -> SET NAMES STRING','set_names_statement',3,'p_set_names_statement','parser.py',167), - ('set_autocommit_statement -> SET AUTOCOMMIT = NUMBER','set_autocommit_statement',4,'p_set_statement_autocommit','parser.py',172), - ('commit_statement -> COMMIT','commit_statement',1,'p_commit_statement','parser.py',178), - ('create_table_statement -> CREATE TABLE identifier ( create_definition_list )','create_table_statement',6,'p_create_table_statement','parser.py',183), - ('create_database_statement -> CREATE DATABASE identifier','create_database_statement',3,'p_create_database_statement','parser.py',192), - ('show_databases_statement -> SHOW DATABASES','show_databases_statement',2,'p_show_databases_statement','parser.py',198), - ('use_database_statement -> USE identifier','use_database_statement',2,'p_use_database_statement','parser.py',205), - ('identifier -> STRING','identifier',1,'p_identifier','parser.py',213), - ('identifier -> ` STRING `','identifier',3,'p_identifier_escaped','parser.py',218), - ('create_definition_list -> create_definition','create_definition_list',1,'p_create_definition_list_one','parser.py',223), - ('create_definition_list -> create_definition_list , create_definition','create_definition_list',3,'p_create_definition_list_many','parser.py',228), - ('create_definition -> identifier column_definition','create_definition',2,'p_create_definition','parser.py',235), - ('column_definition -> data_type opt_column_def_options_list','column_definition',2,'p_column_definition','parser.py',240), - ('data_type -> INTEGER opt_UNSIGNED','data_type',2,'p_data_type','parser.py',248), - ('data_type -> VARCHAR ( NUMBER )','data_type',4,'p_data_type','parser.py',249), - ('data_type -> DATETIME','data_type',1,'p_data_type','parser.py',250), - ('data_type -> DATETIME ( NUMBER )','data_type',4,'p_data_type','parser.py',251), - ('data_type -> INT opt_UNSIGNED','data_type',2,'p_data_type','parser.py',252), - ('data_type -> LONGTEXT','data_type',1,'p_data_type','parser.py',253), - ('data_type -> SMALLINT opt_UNSIGNED','data_type',2,'p_data_type','parser.py',254), - ('data_type -> TINYINT','data_type',1,'p_data_type','parser.py',255), - ('data_type -> BOOL','data_type',1,'p_data_type','parser.py',256), - ('opt_UNSIGNED -> ','opt_UNSIGNED',0,'p_opt_UNSIGNED','parser.py',261), - ('opt_UNSIGNED -> UNSIGNED','opt_UNSIGNED',1,'p_opt_UNSIGNED','parser.py',262), - ('opt_column_def_options_list -> ','opt_column_def_options_list',0,'p_opt_column_def_options_list_empty','parser.py',266), - ('opt_column_def_options_list -> opt_column_def_options opt_column_def_options_list','opt_column_def_options_list',2,'p_opt_column_def_options_list','parser.py',273), - ('opt_column_def_options -> DEFAULT value','opt_column_def_options',2,'p_DEFAULT_CLAUSE','parser.py',282), - ('opt_column_def_options -> NULL','opt_column_def_options',1,'p_NULL','parser.py',289), - ('opt_column_def_options -> NOT NULL','opt_column_def_options',2,'p_NOT_NULL','parser.py',296), - ('opt_column_def_options -> AUTO_INCREMENT','opt_column_def_options',1,'p_AUTO_INCREMENT','parser.py',303), - ('opt_column_def_options -> PRIMARY KEY','opt_column_def_options',2,'p_PRIMARY_KEY','parser.py',310), - ('opt_column_def_options -> UNIQUE','opt_column_def_options',1,'p_UNIQUE','parser.py',317), - ('value -> q_STRING','value',1,'p_value','parser.py',324), - ('value -> NUMBER','value',1,'p_value','parser.py',325), - ('value -> STRING_VALUE','value',1,'p_value','parser.py',326), - ("q_STRING -> ' STRING '",'q_STRING',3,'p_q_STRING','parser.py',331), - ('q_STRING -> ','q_STRING',0,'p_q_STRING_EMPTY','parser.py',336), - ('select_statement -> SELECT select_item_list opt_FROM opt_WHERE opt_ORDER_BY opt_LIMIT','select_statement',6,'p_select_statement','parser.py',341), - ('opt_ORDER_BY -> ','opt_ORDER_BY',0,'p_opt_ORDER_BY_empty','parser.py',354), - ('opt_ORDER_BY -> ORDER BY identifier opt_ORDER_DIRECTION','opt_ORDER_BY',4,'p_opt_ORDER_BY_simple','parser.py',358), - ('opt_ORDER_BY -> ORDER BY identifier . identifier opt_ORDER_DIRECTION','opt_ORDER_BY',6,'p_opt_ORDER_BY_extended','parser.py',364), - ('opt_ORDER_DIRECTION -> ','opt_ORDER_DIRECTION',0,'p_opt_ORDER_DIRECTION_empty','parser.py',370), - ('opt_ORDER_DIRECTION -> ASC','opt_ORDER_DIRECTION',1,'p_opt_ORDER_DIRECTION','parser.py',375), - ('opt_ORDER_DIRECTION -> DESC','opt_ORDER_DIRECTION',1,'p_opt_ORDER_DIRECTION','parser.py',376), - ('opt_LIMIT -> ','opt_LIMIT',0,'p_opt_LIMIT_empty','parser.py',381), - ('opt_LIMIT -> LIMIT NUMBER','opt_LIMIT',2,'p_opt_LIMIT','parser.py',386), - ('show_tables_statement -> SHOW opt_FULL TABLES','show_tables_statement',3,'p_show_tables_statement','parser.py',391), - ('opt_FROM -> ','opt_FROM',0,'p_opt_from_empty','parser.py',397), - ('opt_FROM -> FROM table_reference','opt_FROM',2,'p_opt_from','parser.py',402), - ('table_reference -> identifier','table_reference',1,'p_table_reference','parser.py',408), - ('table_reference -> identifier . identifier','table_reference',3,'p_table_reference_w_database','parser.py',413), - ('opt_FULL -> ','opt_FULL',0,'p_opt_FULL_empty','parser.py',419), - ('opt_FULL -> FULL','opt_FULL',1,'p_opt_FULL','parser.py',424), - ('select_item_list -> select_item','select_item_list',1,'p_select_item_list_select_item','parser.py',429), - ('select_item_list -> select_item_list , select_item','select_item_list',3,'p_select_item_list','parser.py',434), - ('select_item_list -> *','select_item_list',1,'p_select_item_list_star','parser.py',441), - ('select_item -> select_item2 select_alias','select_item',2,'p_select_item','parser.py',451), - ('select_item2 -> table_wild','select_item2',1,'p_select_item2','parser.py',456), - ('select_item2 -> expr','select_item2',1,'p_select_item2','parser.py',457), - ('select_alias -> ','select_alias',0,'p_select_alias_empty','parser.py',462), - ('select_alias -> AS identifier','select_alias',2,'p_select_alias','parser.py',467), - ('table_wild -> identifier . *','table_wild',3,'p_table_wild','parser.py',472), - ('opt_WHERE -> ','opt_WHERE',0,'p_opt_WHERE_empty','parser.py',477), - ('opt_WHERE -> WHERE expr','opt_WHERE',2,'p_opt_WHERE','parser.py',481), - ('expr -> expr OR expr','expr',3,'p_expr_OR','parser.py',486), - ('expr -> expr AND expr','expr',3,'p_expr_AND','parser.py',491), - ('expr -> NOT expr','expr',2,'p_expr_NOT','parser.py',496), - ('expr -> boolean_primary','expr',1,'p_expr_bool_primary','parser.py',501), - ('boolean_primary -> boolean_primary IS NULL','boolean_primary',3,'p_boolean_primary_is_null','parser.py',506), - ('boolean_primary -> boolean_primary IS NOT NULL','boolean_primary',4,'p_boolean_primary_is_not_null','parser.py',511), - ('boolean_primary -> boolean_primary comparison_operator predicate','boolean_primary',3,'p_boolean_primary_comparison','parser.py',516), - ('boolean_primary -> predicate','boolean_primary',1,'p_boolean_primary_predicate','parser.py',521), - ('comparison_operator -> =','comparison_operator',1,'p_comparison_operator','parser.py',526), - ('comparison_operator -> GREATER_OR_EQ','comparison_operator',1,'p_comparison_operator','parser.py',527), - ('comparison_operator -> >','comparison_operator',1,'p_comparison_operator','parser.py',528), - ('comparison_operator -> LESS_OR_EQ','comparison_operator',1,'p_comparison_operator','parser.py',529), - ('comparison_operator -> <','comparison_operator',1,'p_comparison_operator','parser.py',530), - ('comparison_operator -> N_EQ','comparison_operator',1,'p_comparison_operator','parser.py',531), - ('predicate -> bit_expr','predicate',1,'p_predicate','parser.py',536), - ('predicate -> bit_expr IN ( list_expr )','predicate',5,'p_predicate_in','parser.py',541), - ('list_expr -> expr','list_expr',1,'p_list_expr_one','parser.py',550), - ('list_expr -> list_expr , expr','list_expr',3,'p_list_expr','parser.py',555), - ('bit_expr -> simple_expr','bit_expr',1,'p_bit_expr','parser.py',561), - ('simple_expr -> identifier','simple_expr',1,'p_simple_expr_identifier','parser.py',566), - ('simple_expr -> identifier . identifier','simple_expr',3,'p_simple_expr_identifier_full','parser.py',571), - ('simple_expr -> ( expr )','simple_expr',3,'p_simple_expr_parent','parser.py',581), - ('simple_expr -> variable','simple_expr',1,'p_simple_expr_variable','parser.py',586), - ('variable -> @ @ STRING','variable',3,'p_variable','parser.py',591), - ('simple_expr -> literal','simple_expr',1,'p_simple_expr_literal','parser.py',596), - ('literal -> q_STRING','literal',1,'p_literal','parser.py',601), - ('literal -> NUMBER','literal',1,'p_literal','parser.py',602), - ('literal -> STRING_VALUE','literal',1,'p_literal','parser.py',603), - ('simple_expr -> function_call','simple_expr',1,'p_simple_expr_function_call','parser.py',608), - ('function_call -> VERSION ( )','function_call',3,'p_function_call_version','parser.py',613), - ('function_call -> COUNT ( * )','function_call',4,'p_function_call_count_star','parser.py',618), - ('delete_statement -> DELETE FROM identifier opt_WHERE','delete_statement',4,'p_delete_statement','parser.py',623), + ('opt_AFTER -> ','opt_AFTER',0,'p_opt_after_empty','parser.py',50), + ('opt_AFTER -> AFTER NUMBER','opt_AFTER',2,'p_opt_after','parser.py',54), + ('update_table_statement -> UPDATE identifier SET col_expr_list opt_WHERE','update_table_statement',5,'p_update_table_statement','parser.py',62), + ('col_expr_list -> col_expr','col_expr_list',1,'p_col_expr_list_one','parser.py',72), + ('col_expr_list -> col_expr_list , col_expr','col_expr_list',3,'p_col_expr_list','parser.py',77), + ('col_expr -> identifier = expr','col_expr',3,'p_col_expr','parser.py',83), + ('desc_table_statement -> DESC identifier','desc_table_statement',2,'p_desc_table_statement','parser.py',88), + ('drop_database_statement -> DROP DATABASE identifier','drop_database_statement',3,'p_drop_database_statement','parser.py',96), + ('drop_table_statement -> DROP TABLE identifier opt_IF_EXISTS','drop_table_statement',4,'p_drop_table_statement','parser.py',104), + ('opt_IF_EXISTS -> ','opt_IF_EXISTS',0,'p_opt_if_exists_empty','parser.py',113), + ('opt_IF_EXISTS -> IF EXISTS','opt_IF_EXISTS',2,'p_opt_if_exists','parser.py',118), + ('insert_statement -> INSERT INTO identifier opt_fieldlist VALUES ( values_list )','insert_statement',8,'p_insert_statement','parser.py',123), + ('opt_fieldlist -> ','opt_fieldlist',0,'p_opt_fieldlist_empty','parser.py',142), + ('opt_fieldlist -> ( fieldlist )','opt_fieldlist',3,'p_opt_fieldlist','parser.py',147), + ('fieldlist -> identifier','fieldlist',1,'p_fieldlist_one','parser.py',152), + ('fieldlist -> fieldlist , identifier','fieldlist',3,'p_fieldlist_many','parser.py',157), + ('values_list -> value','values_list',1,'p_values_list_one','parser.py',166), + ('values_list -> values_list , value','values_list',3,'p_values_list_many','parser.py',171), + ('set_statement -> set_autocommit_statement','set_statement',1,'p_set_statement','parser.py',180), + ('set_statement -> set_names_statement','set_statement',1,'p_set_statement','parser.py',181), + ('set_names_statement -> SET NAMES STRING','set_names_statement',3,'p_set_names_statement','parser.py',186), + ('set_autocommit_statement -> SET AUTOCOMMIT = NUMBER','set_autocommit_statement',4,'p_set_statement_autocommit','parser.py',193), + ('commit_statement -> COMMIT','commit_statement',1,'p_commit_statement','parser.py',201), + ('create_table_statement -> CREATE TABLE identifier ( create_definition_list )','create_table_statement',6,'p_create_table_statement','parser.py',208), + ('create_database_statement -> CREATE DATABASE identifier','create_database_statement',3,'p_create_database_statement','parser.py',217), + ('show_databases_statement -> SHOW DATABASES','show_databases_statement',2,'p_show_databases_statement','parser.py',225), + ('use_database_statement -> USE identifier','use_database_statement',2,'p_use_database_statement','parser.py',232), + ('identifier -> STRING','identifier',1,'p_identifier','parser.py',240), + ('identifier -> ` STRING `','identifier',3,'p_identifier_escaped','parser.py',245), + ('create_definition_list -> create_definition','create_definition_list',1,'p_create_definition_list_one','parser.py',250), + ('create_definition_list -> create_definition_list , create_definition','create_definition_list',3,'p_create_definition_list_many','parser.py',257), + ('create_definition -> identifier column_definition','create_definition',2,'p_create_definition','parser.py',264), + ('column_definition -> data_type opt_column_def_options_list','column_definition',2,'p_column_definition','parser.py',269), + ('data_type -> INTEGER opt_UNSIGNED','data_type',2,'p_data_type','parser.py',277), + ('data_type -> VARCHAR ( NUMBER )','data_type',4,'p_data_type','parser.py',278), + ('data_type -> DATETIME','data_type',1,'p_data_type','parser.py',279), + ('data_type -> DATETIME ( NUMBER )','data_type',4,'p_data_type','parser.py',280), + ('data_type -> INT opt_UNSIGNED','data_type',2,'p_data_type','parser.py',281), + ('data_type -> LONGTEXT','data_type',1,'p_data_type','parser.py',282), + ('data_type -> SMALLINT opt_UNSIGNED','data_type',2,'p_data_type','parser.py',283), + ('data_type -> TINYINT','data_type',1,'p_data_type','parser.py',284), + ('data_type -> BOOL','data_type',1,'p_data_type','parser.py',285), + ('opt_UNSIGNED -> ','opt_UNSIGNED',0,'p_opt_UNSIGNED','parser.py',290), + ('opt_UNSIGNED -> UNSIGNED','opt_UNSIGNED',1,'p_opt_UNSIGNED','parser.py',291), + ('opt_column_def_options_list -> ','opt_column_def_options_list',0,'p_opt_column_def_options_list_empty','parser.py',295), + ('opt_column_def_options_list -> opt_column_def_options opt_column_def_options_list','opt_column_def_options_list',2,'p_opt_column_def_options_list','parser.py',302), + ('opt_column_def_options -> DEFAULT value','opt_column_def_options',2,'p_DEFAULT_CLAUSE','parser.py',311), + ('opt_column_def_options -> NULL','opt_column_def_options',1,'p_NULL','parser.py',318), + ('opt_column_def_options -> NOT NULL','opt_column_def_options',2,'p_NOT_NULL','parser.py',325), + ('opt_column_def_options -> AUTO_INCREMENT','opt_column_def_options',1,'p_AUTO_INCREMENT','parser.py',332), + ('opt_column_def_options -> PRIMARY KEY','opt_column_def_options',2,'p_PRIMARY_KEY','parser.py',339), + ('opt_column_def_options -> UNIQUE','opt_column_def_options',1,'p_UNIQUE','parser.py',346), + ('value -> q_STRING','value',1,'p_value','parser.py',353), + ('value -> NUMBER','value',1,'p_value','parser.py',354), + ('value -> STRING_VALUE','value',1,'p_value','parser.py',355), + ("q_STRING -> ' STRING '",'q_STRING',3,'p_q_STRING','parser.py',360), + ('q_STRING -> ','q_STRING',0,'p_q_STRING_EMPTY','parser.py',365), + ('select_statement -> SELECT select_item_list opt_FROM opt_WHERE opt_ORDER_BY opt_LIMIT','select_statement',6,'p_select_statement','parser.py',370), + ('opt_ORDER_BY -> ','opt_ORDER_BY',0,'p_opt_ORDER_BY_empty','parser.py',388), + ('opt_ORDER_BY -> ORDER BY identifier opt_ORDER_DIRECTION','opt_ORDER_BY',4,'p_opt_ORDER_BY_simple','parser.py',393), + ('opt_ORDER_BY -> ORDER BY identifier . identifier opt_ORDER_DIRECTION','opt_ORDER_BY',6,'p_opt_ORDER_BY_extended','parser.py',402), + ('opt_ORDER_DIRECTION -> ','opt_ORDER_DIRECTION',0,'p_opt_ORDER_DIRECTION_empty','parser.py',411), + ('opt_ORDER_DIRECTION -> ASC','opt_ORDER_DIRECTION',1,'p_opt_ORDER_DIRECTION','parser.py',416), + ('opt_ORDER_DIRECTION -> DESC','opt_ORDER_DIRECTION',1,'p_opt_ORDER_DIRECTION','parser.py',417), + ('opt_LIMIT -> ','opt_LIMIT',0,'p_opt_LIMIT_empty','parser.py',422), + ('opt_LIMIT -> LIMIT NUMBER','opt_LIMIT',2,'p_opt_LIMIT','parser.py',427), + ('show_tables_statement -> SHOW opt_FULL TABLES','show_tables_statement',3,'p_show_tables_statement','parser.py',432), + ('opt_FROM -> ','opt_FROM',0,'p_opt_from_empty','parser.py',440), + ('opt_FROM -> FROM table_reference','opt_FROM',2,'p_opt_from','parser.py',445), + ('table_reference -> identifier','table_reference',1,'p_table_reference','parser.py',450), + ('table_reference -> identifier . identifier','table_reference',3,'p_table_reference_w_database','parser.py',455), + ('opt_FULL -> ','opt_FULL',0,'p_opt_FULL_empty','parser.py',460), + ('opt_FULL -> FULL','opt_FULL',1,'p_opt_FULL','parser.py',465), + ('select_item_list -> select_item','select_item_list',1,'p_select_item_list_select_item','parser.py',470), + ('select_item_list -> select_item_list , select_item','select_item_list',3,'p_select_item_list','parser.py',475), + ('select_item_list -> *','select_item_list',1,'p_select_item_list_star','parser.py',482), + ('select_item -> select_item2 select_alias','select_item',2,'p_select_item','parser.py',492), + ('select_item2 -> table_wild','select_item2',1,'p_select_item2','parser.py',497), + ('select_item2 -> expr','select_item2',1,'p_select_item2','parser.py',498), + ('select_alias -> ','select_alias',0,'p_select_alias_empty','parser.py',503), + ('select_alias -> AS identifier','select_alias',2,'p_select_alias','parser.py',508), + ('table_wild -> identifier . *','table_wild',3,'p_table_wild','parser.py',513), + ('opt_WHERE -> ','opt_WHERE',0,'p_opt_WHERE_empty','parser.py',518), + ('opt_WHERE -> WHERE expr','opt_WHERE',2,'p_opt_WHERE','parser.py',523), + ('expr -> expr OR expr','expr',3,'p_expr_OR','parser.py',528), + ('expr -> expr AND expr','expr',3,'p_expr_AND','parser.py',533), + ('expr -> NOT expr','expr',2,'p_expr_NOT','parser.py',538), + ('expr -> boolean_primary','expr',1,'p_expr_bool_primary','parser.py',543), + ('boolean_primary -> boolean_primary IS NULL','boolean_primary',3,'p_boolean_primary_is_null','parser.py',548), + ('boolean_primary -> boolean_primary IS NOT NULL','boolean_primary',4,'p_boolean_primary_is_not_null','parser.py',553), + ('boolean_primary -> boolean_primary comparison_operator predicate','boolean_primary',3,'p_boolean_primary_comparison','parser.py',558), + ('boolean_primary -> predicate','boolean_primary',1,'p_boolean_primary_predicate','parser.py',563), + ('comparison_operator -> =','comparison_operator',1,'p_comparison_operator','parser.py',568), + ('comparison_operator -> GREATER_OR_EQ','comparison_operator',1,'p_comparison_operator','parser.py',569), + ('comparison_operator -> >','comparison_operator',1,'p_comparison_operator','parser.py',570), + ('comparison_operator -> LESS_OR_EQ','comparison_operator',1,'p_comparison_operator','parser.py',571), + ('comparison_operator -> <','comparison_operator',1,'p_comparison_operator','parser.py',572), + ('comparison_operator -> N_EQ','comparison_operator',1,'p_comparison_operator','parser.py',573), + ('predicate -> bit_expr','predicate',1,'p_predicate','parser.py',578), + ('predicate -> bit_expr IN ( list_expr )','predicate',5,'p_predicate_in','parser.py',583), + ('list_expr -> expr','list_expr',1,'p_list_expr_one','parser.py',592), + ('list_expr -> list_expr , expr','list_expr',3,'p_list_expr','parser.py',597), + ('bit_expr -> simple_expr','bit_expr',1,'p_bit_expr','parser.py',603), + ('simple_expr -> identifier','simple_expr',1,'p_simple_expr_identifier','parser.py',608), + ('simple_expr -> identifier . identifier','simple_expr',3,'p_simple_expr_identifier_full','parser.py',613), + ('simple_expr -> ( expr )','simple_expr',3,'p_simple_expr_parent','parser.py',618), + ('simple_expr -> variable','simple_expr',1,'p_simple_expr_variable','parser.py',623), + ('variable -> @ @ STRING','variable',3,'p_variable','parser.py',628), + ('simple_expr -> literal','simple_expr',1,'p_simple_expr_literal','parser.py',633), + ('literal -> q_STRING','literal',1,'p_literal','parser.py',638), + ('literal -> NUMBER','literal',1,'p_literal','parser.py',639), + ('literal -> STRING_VALUE','literal',1,'p_literal','parser.py',640), + ('simple_expr -> function_call','simple_expr',1,'p_simple_expr_function_call','parser.py',645), + ('function_call -> VERSION ( )','function_call',3,'p_function_call_version','parser.py',650), + ('function_call -> COUNT ( * )','function_call',4,'p_function_call_count_star','parser.py',655), + ('delete_statement -> DELETE FROM identifier opt_WHERE','delete_statement',4,'p_delete_statement','parser.py',660), ] diff --git a/requirements_dev.txt b/requirements_dev.txt index 5cd29e7..c3d8165 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -10,3 +10,4 @@ pytest-cov Sphinx psutil pytest-timeout +pytest-cov diff --git a/support/run_func_test.sh b/support/run_func_test.sh index f62335f..88661ad 100644 --- a/support/run_func_test.sh +++ b/support/run_func_test.sh @@ -2,4 +2,4 @@ source /etcdb/support/bootstrap.sh -make -C /etcdb bootstrap test-functional +make -C /etcdb clean bootstrap test-functional