Skip to content

Commit 3ae4aff

Browse files
committed
name as identifier in CreateView
1 parent 559c6be commit 3ae4aff

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

mindsdb_sql_parser/ast/mindsdb/create_view.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ def __init__(self,
1010
if_not_exists=False,
1111
*args, **kwargs):
1212
super().__init__(*args, **kwargs)
13-
# todo remove it
14-
if isinstance(name, Identifier):
15-
name = name.to_string()
1613
self.name = name
1714
self.query_str = query_str
1815
self.from_table = from_table
@@ -21,8 +18,7 @@ def __init__(self,
2118
def to_tree(self, *args, level=0, **kwargs):
2219
ind = indent(level)
2320
ind1 = indent(level+1)
24-
name_str = f'\n{ind1}name={repr(self.name)},'
25-
# name_str = f'\n{ind1}name={self.name.to_string()},'
21+
name_str = f'\n{ind1}name={self.name.to_string()},'
2622
from_table_str = f'\n{ind1}from_table=\n{self.from_table.to_tree(level=level+2)},' if self.from_table else ''
2723
query_str = f'\n{ind1}query="{self.query_str}"'
2824
if_not_exists_str = f'\n{ind1}if_not_exists=True,' if self.if_not_exists else ''
@@ -37,8 +33,7 @@ def to_tree(self, *args, level=0, **kwargs):
3733

3834
def get_string(self, *args, **kwargs):
3935
from_str = f'FROM {str(self.from_table)} ' if self.from_table else ''
40-
# out_str = f'CREATE VIEW {self.name.to_string()} {from_str}AS ( {self.query_str} )'
41-
out_str = f'CREATE VIEW {"IF NOT EXISTS " if self.if_not_exists else ""}{str(self.name)} {from_str}AS ( {self.query_str} )'
36+
out_str = f'CREATE VIEW {"IF NOT EXISTS " if self.if_not_exists else ""}{self.name.to_string()} {from_str}AS ( {self.query_str} )'
4237

4338
return out_str
4439

0 commit comments

Comments
 (0)