I'm using atom editor for python with embedded SQL similar to this:

import sqlite3

conn = sqlite3.connect('spider.sqlite')
cur = conn.cursor()

cur.execute('''SELECT COUNT(from_id) AS inbound, old_rank, new_rank, id, url 
     FROM Pages JOIN Links ON Pages.id = Links.to_id
     GROUP BY id ORDER BY inbound DESC''')

count = 0
for row in cur :
    if count < 50 : print(row)
    count = count + 1
print(count, 'rows.')

Any of you who've taken the Coursera python courses will recognize the above code--what's odd is that in the videos, Dr. Chuck's atom environment highlights at least the conventionally capitalized sql keywords such as SELECT, CREATE, FROM, etc. but he never mentions having to do anything to atom to have this happen. What I see in my installation, on the other hand, is that everything within the triple quotes is highlighted as comment text (all green in my theme).

This comment, even though the main thread is referring to MagicPython, (https://github.com/MagicStack/MagicPython/issues/27#issuecomment-418155497) suggests that Atom and SublimeText both support highlighting SQL natively, but even installing the sublime package into Atom does nothing but give me a light "sublimify" sidebar when I just want to keep my native dark UI.

Can anyone point me in the right direction to get triple quoted SQL within python highlighted properly in atom? Thanks!

Edit: I'm running MacOS Sierra (10.12.6) if it matters.

  • 1
    Odd: the grammar should recognize a block that starts with SELECT or other keywords as meta.embedded.sql. I'm having the same problem on Mojave with atom 1.37.0, FWIW. Jun 6, 2019 at 20:16

1 Answer 1


Answer: go to settings > core and uncheck Use Tree Sitter Parsers (it's at the bottom of the core settings menu. You may have to close and reopen the document for the changes to take effect.

What caused the problem:

At the moment, language-sql does not yet provide a Tree-sitter grammar, so Atom cannot provide SQL syntax highlighting [where other grammars try to inject it]

[gh issue with explanation] [relevant language-python issue]

If you want to contribute to fixing the root issue, take a look at the tree-sitter documentation and contribute to language-sql!

  • 1
    Well, I sure let that go -- I finished the Coursera course and didn't have SQL come up again (I'm not usually a coder by trade). But, even though almost 2 years have gone by and I've upgraded to Catalina and my atom is now about 4 major versions newer, this is still an issue, and your answer works to fix it! Unchecked Use Tree Sitter Parsers and voila! (most of) my SQL keywords are highlighted (only DROP TABLE lines do not get highlighted). Thanks! May 1, 2021 at 22:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.