diff options
| author | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-13 22:01:53 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-15 13:29:13 -0700 |
| commit | 4f922d9b6fb68b8281c6b3d93a57a4c84860e06a (patch) | |
| tree | 8101d546c24b473e90874b7dc88b0ec1d1bf1550 /examples | |
| parent | 711744d1664f8244d8ab0b090cbf12e923101cce (diff) | |
| download | sqlparse-4f922d9b6fb68b8281c6b3d93a57a4c84860e06a.tar.gz | |
Rename token_idx_ funcs to simply token_ funcs
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/column_defs_lowlevel.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/column_defs_lowlevel.py b/examples/column_defs_lowlevel.py index 1ebd065..584b3f3 100644 --- a/examples/column_defs_lowlevel.py +++ b/examples/column_defs_lowlevel.py @@ -17,16 +17,16 @@ def extract_definitions(token_list): definitions = [] tmp = [] # grab the first token, ignoring whitespace. idx=1 to skip open ( - tidx, token = token_list.token_idx_next(1) + tidx, token = token_list.token_next(1) while token and not token.match(sqlparse.tokens.Punctuation, ')'): tmp.append(token) # grab the next token, this times including whitespace - tidx, token = token_list.token_idx_next(tidx, skip_ws=False) + tidx, token = token_list.token_next(tidx, skip_ws=False) # split on ",", except when on end of statement if token and token.match(sqlparse.tokens.Punctuation, ','): definitions.append(tmp) tmp = [] - tidx, token = token_list.token_idx_next(tidx) + tidx, token = token_list.token_next(tidx) if tmp and isinstance(tmp[0], sqlparse.sql.Identifier): definitions.append(tmp) return definitions @@ -41,7 +41,7 @@ if __name__ == '__main__': parsed = sqlparse.parse(SQL)[0] # extract the parenthesis which holds column definitions - _, par = parsed.token_idx_next_by(i=sqlparse.sql.Parenthesis) + _, par = parsed.token_next_by(i=sqlparse.sql.Parenthesis) columns = extract_definitions(par) for column in columns: |
