Position of tokens

124 views
Skip to first unread message

idan...@gmail.com

unread,
Feb 14, 2016, 9:48:35 AM2/14/16
to sqlparse
Hello,

Is it possible to get the position of tokens? I'd like to parse some SQL and then generate an HTML version of it, e.g. by wrapping some tokens with tags:

select * from foo;
->
<span class="select">select</span> <span class="columns">*</span> <span class="from">from <span class="tables">foo</span></span>

Andi Albrecht

unread,
Feb 14, 2016, 10:24:37 AM2/14/16
to sqlparse
Hi,

the short answer: It's not yet supported. Please follow https://github.com/andialbrecht/sqlparse/issues/82 for progress on this issue.

But why not use a standard highlighting library, like https://highlightjs.org/ on the frontend side or Pygments on the Python side?

Best regards,

Andi

--
You received this message because you are subscribed to the Google Groups "sqlparse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlparse+u...@googlegroups.com.
To post to this group, send email to sqlp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlparse.
For more options, visit https://groups.google.com/d/optout.

idan...@gmail.com

unread,
Feb 14, 2016, 7:16:20 PM2/14/16
to sqlparse
My end goal isn't syntax highlighting, but something else, and I'd need the positions and knowledge of the meaning of tokens for that.

Do you have an ETA for this feature? Thanks.
Reply all
Reply to author
Forward
0 new messages