@@ -19,19 +19,21 @@ class QueryBuilder:
1919 ">=" ,
2020 "<=" ,
2121 "!=" ,
22+ "<>" ,
2223 "LIKE" ,
2324 "NOT LIKE" ,
2425 "IN" ,
2526 "NOT IN" ,
2627 ]
27- _MATH_OPERATORS : list = [
28+ _FIELD_SPEC_CHARS : list = [
2829 "+" ,
2930 "-" ,
3031 "*" ,
3132 "/" ,
3233 "%" ,
3334 "(" ,
3435 ")" ,
36+ "||" ,
3537 ]
3638 _LOGICS : list = [
3739 "AND" ,
@@ -348,7 +350,11 @@ def select(self, table: Union[str, dict], fields: Union[str, list, dict] = "*"):
348350 return self
349351
350352 if isinstance (table , dict ) or isinstance (table , str ):
351- self ._sql += f" FROM { self ._prepare_aliases (table )} "
353+ if isinstance (table , str ) and any (x in table for x in self ._FIELD_SPEC_CHARS ) and fields == '*' :
354+ self ._sql = f"SELECT { table } "
355+ self ._fields = table
356+ else :
357+ self ._sql += f" FROM { self ._prepare_aliases (table )} "
352358 else :
353359 self .set_error (f"Incorrect type of table in { inspect .stack ()[0 ][3 ]} method. Table must be String or Dictionary" )
354360 return self
@@ -457,7 +463,7 @@ def _prepare_field(self, field: str = "") -> str:
457463 self .set_error (f"Empty field in { inspect .stack ()[0 ][3 ]} method" )
458464 return ""
459465
460- if any (x in field for x in self ._MATH_OPERATORS ):
466+ if any (x in field for x in self ._FIELD_SPEC_CHARS ):
461467 if field .find (" AS " ) > - 1 :
462468 field = field .replace (" AS " , " AS `" )
463469 return f"{ field } `"
0 commit comments