andialbrecht / sqlparse

A non-validating SQL parser module for Python
BSD 3-Clause "New" or "Revised" License
3.71k stars 693 forks source link

In `CREATE MATERIALIZED VIEW` statements `MATERIALIZED` is not recognized as a keyword #752

Open sean-rose opened 10 months ago

sean-rose commented 10 months ago

Describe the bug In CREATE MATERIALIZED VIEW statements MATERIALIZED is not recognized as a keyword.

To Reproduce

import sqlparse
parsed = sqlparse.parse('create materialized view x.y.z as select 1 as id')[0]
print(parsed.tokens[2].is_keyword)  # This should be True
print(parsed.tokens[2].normalized)  # This should be "MATERIALIZED" (uppercased)

Expected behavior In CREATE MATERIALIZED VIEW statements MATERIALIZED should be recognized as a keyword, and thus should also be automatically uppercased in the normalized property.

Versions (please complete the following information):

Additional context N/A