You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/27 12:59:46 UTC

[GitHub] [superset] Musa10 opened a new issue #18197: CTAS error "mssql error: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'CREATE'. (156) (SQLExecDirectW)")"

Musa10 opened a new issue #18197:
URL: https://github.com/apache/superset/issues/18197


   I am trying to create a table from a select statement with Microsoft SQL Server data base from CREATE TABLE AS in sql lab,
    ..the statement that occuring is:
    SELECT TOP 1001 *
   FROM (CREATE TABLE moe_db.sasa  AS
   select
   Main.TNO_YEAR as "YEAR",
   trade_type.en_type as "Trade Type",
   trade_cat.en_cat as "Trade Category",
   countries.CNT_Country_EN as "Country",
   Main.[TNO_HS_CODE8_FKC] as "8D_Code",
   Main.Value_AED as "Value AED",
   Main.Value_AED/3.673 as "Value USD",
   Main.Weight_KG as "Weight KG"
   from
   (Select
   trade.TNO_YEAR,
   trade.TNO_TYP_ID_FKN,
   trade.TNO_CAT_ID_FKN,
   trade.TNO_CNT_ID_FKN,
   trade.[TNO_HS_CODE8_FKC],
   sum (trade.[TNO_Value_AED]) as "Value_AED",
   sum(trade.TNO_Weight_GK) as "Weight_KG"
   from  [moe_db].[tbl_nonoil_trade_8d] trade
   group by  trade.TNO_YEAR, trade.TNO_TYP_ID_FKN,trade.TNO_CAT_ID_FKN, trade.TNO_CNT_ID_FKN, trade.[TNO_HS_CODE8_FKC] ) Main
   left join [moe_db].[tbl_country_dfn] countries on countries.CNT_ID = Main.[TNO_CNT_ID_FKN]
   left join [moe_db].[tbl_trade_type] trade_type on trade_type.id = Main.[TNO_TYP_ID_FKN]
   left join [moe_db].[tbl_trade_category] trade_cat on trade_cat.id = Main.TNO_CAT_ID_FKN) AS inner_qry
   and the console result is:
   2022-01-27 14:50:22,237:ERROR:superset.sql_lab:Query 29: <class 'pyodbc.ProgrammingError'>
   Traceback (most recent call last):
     File "/home/musaa/bisupersetcore/superset/sql_lab.py", line 244, in execute_sql_statement
       db_engine_spec.execute(cursor, sql, async_=True)
     File "/home/musaa/bisupersetcore/superset/db_engine_specs/base.py", line 1114, in execute
       raise cls.get_dbapi_mapped_exception(ex)
     File "/home/musaa/bisupersetcore/superset/db_engine_specs/base.py", line 1112, in execute
       cursor.execute(query)
   pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'CREATE'. (156) (SQLExecDirectW)")
   2022-01-27 14:50:22,239:DEBUG:superset.sql_lab:Query 29: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'CREATE'. (156) (SQLExecDirectW)")
   2022-01-27 14:50:22,265:WARNING:superset.views.base:[SupersetError(message='mssql error: (\'42000\', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword \'CREATE\'. (156) (SQLExecDirectW)")', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'Azure Synapse', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
   Traceback (most recent call last):
     File "/home/musaa/bisupersetcore/superset/views/base.py", line 205, in wraps
       return f(self, *args, **kwargs)
     File "/home/musaa/bisupersetcore/superset/utils/log.py", line 242, in wrapper
       value = f(*args, **kwargs)
     File "/home/musaa/bisupersetcore/superset/views/core.py", line 2475, in sql_json
       command_result: CommandResult = command.run()
     File "/home/musaa/bisupersetcore/superset/sqllab/command.py", line 104, in run
       raise ex
     File "/home/musaa/bisupersetcore/superset/sqllab/command.py", line 96, in run
       status = self._run_sql_json_exec_from_scratch()
     File "/home/musaa/bisupersetcore/superset/sqllab/command.py", line 138, in _run_sql_json_exec_from_scratch
       raise ex
     File "/home/musaa/bisupersetcore/superset/sqllab/command.py", line 133, in _run_sql_json_exec_from_scratch
       return self._sql_json_executor.execute(
     File "/home/musaa/bisupersetcore/superset/sqllab/sql_json_executer.py", line 111, in execute
       raise SupersetErrorsException(
   superset.exceptions.SupersetErrorsException: [SupersetError(message='mssql error: (\'42000\', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword \'CREATE\'. (156) (SQLExecDirectW)")', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'Azure Synapse', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
   127.0.0.1 - - [27/Jan/2022 14:50:22] "POST /superset/sql_json/ HTTP/1.1" 500 -
   2022-01-27 14:50:22,267:INFO:werkzeug:127.0.0.1 - - [27/Jan/2022 14:50:22] "POST /superset/sql_json/ HTTP/1.1" 500 -
   Any help??
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] srinify commented on issue #18197: CTAS error "mssql error: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'CREATE'. (156) (SQLExecDirectW)")"

Posted by GitBox <gi...@apache.org>.
srinify commented on issue #18197:
URL: https://github.com/apache/superset/issues/18197#issuecomment-1023218319


   Hey @Musa10 do you mind posting in the #debug-together channel in the Superset Slack or over in Github Discussions? You can find a link to our Slack here: https://superset.apache.org/community
   
   We'd like to keep Github issues focused on bugs with reproduction instructions that can be validated, etc.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] srinify closed issue #18197: CTAS error "mssql error: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'CREATE'. (156) (SQLExecDirectW)")"

Posted by GitBox <gi...@apache.org>.
srinify closed issue #18197:
URL: https://github.com/apache/superset/issues/18197


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org