Having issues with SQL syntax within a .py file.
query = """
select top 100 *
from mydb.mytable
"""
The string will be syntax highlighted in a single color, without keyword highlighting, i.e. treated as a vanilla string object.
Have looked into #148 and this does not remedy it. I am running on Sublime Text Build 3176 on macOS.
The installed packages for me are:
A File Icon
Alignment
Anaconda
AutoFileName
Base16
BracketHighlighter
Color Highlighter
Colorcoder
Conda
Dotfiles Syntax Highlighting
ExportHtml
Git
GitGutter
Gutter Color
Jedi - Python autocompletion
LiveReload
Log Highlight
MarkdownEditing
Material Theme
Material Theme - Appbar
Material Theme - White Panels
Package Control
Predawn
Python Imports Sorter
Python PEP8 Autoformat
SAS Programming
Sass
SCSS
SideBarEnhancement
SublimeLinter
SublimeLinter-flake8
SublimeLinter-pycodestyle
SublimeREPL
Swift
Theme - Argonaut
Theme - Glacier
Theme - Seti Monkai
Theme - Spacegray
TrailingSpaces
Use all-caps for your SQL terms (or even just the first one).
Thanks for the suggestion. Unfortunately, it didn't work in my instance.

I believe it is currently only looking for uppercase identifiers that occur on the same line as the opening string punctuation.

https://github.com/sublimehq/Packages/commit/80aa6a0c681d715534e90c9fe92828735ab22366#diff-62db422a04a96e067da114ba6ed7d6e9R549
I think in my case the issue was passing the string into another function, i.e. db.exc(). Any idea of getting around that?

import tdpy as db
db.exc("""
SELECT top 100 *
from mydb.mytable
""")
db.exc("""
CREATE TABLE mydb.mytable as (
col1 VARCHAR(50),
col2 INTEGER,
col3 VARCHAR(5)
) WITH NO DATA PRIMARY KEY(
col1);
""")
db.exc("""
select top 100 *
from mydb.mytable
""")
@keith-hall Mine does not need to be on the same line. I have a little bit of extra sauce in my repo, but I don't think it's anything relating to this. (I'm pretty sure the only Python changes are #1676)
Thanks Michael and Keith, I think it was the Colorcoder package that prevented the same output as @michaelblyons. I created a new Python (SQL) syntax and added the lowercase keywords to this line sql_indicator: \s*(?:SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH)\b
And voila!

Most helpful comment
@keith-hall Mine does not need to be on the same line. I have a little bit of extra sauce in my repo, but I don't think it's anything relating to this. (I'm pretty sure the only Python changes are #1676)