Skip to content

Commit

Permalink
Update keywords_lists.py
Browse files Browse the repository at this point in the history
Added support of 'MERGE' command.
  • Loading branch information
ravlaska authored Sep 5, 2023
1 parent cf09e64 commit 2ca440b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sql_metadata/keywords_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}

# next statement beginning after with statement
WITH_ENDING_KEYWORDS = {"UPDATE", "SELECT", "DELETE", "REPLACE", "INSERT"}
WITH_ENDING_KEYWORDS = {"UPDATE", "SELECT", "DELETE", "REPLACE", "INSERT", "MERGE"}

# subquery preceding keywords
SUBQUERY_PRECEDING_KEYWORDS = {
Expand All @@ -61,6 +61,7 @@
"INTO": "insert",
"SET": "update",
"GROUPBY": "group_by",
"MERGE": "merge",
}


Expand All @@ -77,6 +78,7 @@ class QueryType(str, Enum):
CREATE = "CREATE TABLE"
ALTER = "ALTER TABLE"
DROP = "DROP TABLE"
MERGE = "MERGE"


class TokenType(str, Enum):
Expand Down Expand Up @@ -104,6 +106,7 @@ class TokenType(str, Enum):
"CREATETABLE": QueryType.CREATE,
"ALTERTABLE": QueryType.ALTER,
"DROPTABLE": QueryType.DROP,
"MERGE": QueryType.MERGE,
}

# all the keywords we care for - rest is ignored in assigning
Expand Down

0 comments on commit 2ca440b

Please sign in to comment.