Repository: tobymao/sqlglot

Issue:
Add support for `CREATE STREAMLIT`
**Is your feature request related to a problem? Please describe.**

After Snowflake's acquisition of Streamlit, they updated their query layer in order to support `CREATE STREAMLIT` queries: https://docs.snowflake.com/en/sql-reference/sql/create-streamlit, which is very similar to `CREATE WAREHOUSE` in that it is a creatable / "create-able" with a number of different attributes. From empirical testing, Snowflake sticks things into its query layer instead of exposing a REST API, so you manage various Streamlit applications using SQL. Would love to have `STREAMLIT` as a registered identifier.

I can create a PR for this later tonight. I'd like to engage in a longer-term commitment to upstreaming to `sqlglot` on a regular basis (since my role involves a lot of this stuff). CC: @whummer

**Describe the solution you'd like**

Running:

```python
parse_one("CREATE STREAMLIT x")
```

Results in:

```python
Create(
  this=Table(
    this=Identifier(this=x, quoted=False)),
  kind=STREAMLIT)
```

or similar, as implemented in #3510 and follow-up.

**Describe alternatives you've considered**

Upstreaming this change for improved tokenization support.


Discussion:
> I can create a PR for this later tonight.

Would be much appreciated. Thanks for these contributions 👍

Btw, feel free to reach out in our [Slack](https://tobikodata.com/slack) channel if you wanna chat about contributions or just in general.

Resolving patch:
diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py
--- a/sqlglot/dialects/snowflake.py
+++ b/sqlglot/dialects/snowflake.py
@@ -483,7 +483,7 @@ class Parser(parser.Parser):
 
         SCHEMA_KINDS = {"OBJECTS", "TABLES", "VIEWS", "SEQUENCES", "UNIQUE KEYS", "IMPORTED KEYS"}
 
-        NON_TABLE_CREATABLES = {"STORAGE INTEGRATION", "TAG", "WAREHOUSE"}
+        NON_TABLE_CREATABLES = {"STORAGE INTEGRATION", "TAG", "WAREHOUSE", "STREAMLIT"}
 
         LAMBDAS = {
             **parser.Parser.LAMBDAS,
@@ -743,6 +743,7 @@ class Tokenizer(tokens.Tokenizer):
             "TIMESTAMP_TZ": TokenType.TIMESTAMPTZ,
             "TOP": TokenType.TOP,
             "WAREHOUSE": TokenType.WAREHOUSE,
+            "STREAMLIT": TokenType.STREAMLIT,
         }
 
         SINGLE_TOKENS = {
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -342,6 +342,7 @@ class Parser(metaclass=_Parser):
         TokenType.TAG,
         TokenType.VIEW,
         TokenType.WAREHOUSE,
+        TokenType.STREAMLIT,
     }
 
     CREATABLES = {
diff --git a/sqlglot/tokens.py b/sqlglot/tokens.py
--- a/sqlglot/tokens.py
+++ b/sqlglot/tokens.py
@@ -93,6 +93,7 @@ class TokenType(AutoName):
     SCHEMA = auto()
     TABLE = auto()
     WAREHOUSE = auto()
+    STREAMLIT = auto()
     VAR = auto()
     BIT_STRING = auto()
     HEX_STRING = auto()


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -1206,6 +1206,7 @@ def test_ddl(self):
         self.validate_identity("CREATE TABLE IDENTIFIER($foo) (col1 VARCHAR, col2 VARCHAR)")
         self.validate_identity("CREATE TAG cost_center ALLOWED_VALUES 'a', 'b'")
         self.validate_identity("CREATE WAREHOUSE x").this.assert_is(exp.Identifier)
+        self.validate_identity("CREATE STREAMLIT x").this.assert_is(exp.Identifier)
         self.validate_identity(
             "CREATE OR REPLACE TAG IF NOT EXISTS cost_center COMMENT='cost_center tag'"
         ).this.assert_is(exp.Identifier)