Azure Synapse SQL on-demand query logs - azure-synapse

I have a question about getting the detailed query usage logs from Azure Synapse on-demand.
With
SELECT * FROM sys.dm_external_data_processed
I can get the daily/weekly usage. It’s good.
But I need to get a result like this:
in a "exportable" way (TSQL or something to query and get usage details for export needs).
I've tried to google it. But with no luck.

Ok, I found it.
On each serverless DB this query gives the details:
SELECT TOP 1000 *
FROM sys.dm_exec_requests_history
order by start_time desc

Related

AWS Athena ErrorCode: INTERNAL_ERROR_QUERY_ENGINE on SELECT query

I am trying to create and view tables in AWS Athena from S3 using SQL queries.
Here is the sequence
CREATE DATABASE testaccesspoint
CREATE EXTERNAL TABLE IF NOT EXISTS `testaccesspoint`......
show tables
The above queries ran successfully and created the database, so I don't feel there is any need to put the complete queries here for this.
Now I am trying to view the table using the query
SELECT * FROM "testaccesspoint"."mybucket" limit 10;
Here is the error I am getting:
[ErrorCode: INTERNAL_ERROR_QUERY_ENGINE] Amazon Athena experienced an internal error while executing this query. Please contact AWS support for further assistance. You will not be charged for this query. We apologize for the inconvenience.
This query ran against the "testaccesspoint" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 024fca79-447d-421f-ac6d-7b283de12adf

Azure Databricks - Generate SQL Select Statement with Columns

I have tables in Azure Databricks that I am using SQL to interact with via a notebook. I need to select all columns from a table with 200 columns, I need to select all of them but I need to modify some for a select insert (To modify specific columns for a PK). Therefore I can not use a select *. (There are multiple scenarios this is just my current objective)
How can I generate a select statement on a table with all the column names in a sql statement. This would be equivalent of a 'Select top N' in SSMS where it generates a select for the table I can than edit.
I have seen functions like describe and show but they can't build a select statement.
I am new to Databricks. Any help is appreciated.
I have the same problem. It is really tough to make and modify SELECT statement for this kind of tables. I have tried many ways and found using the 3rd party software to connect to the table on Azure Databricks worked fine.
Here is what I do:
Download the 3rd party software such as DBeaver
Download Databricks JDBC driver form this page.
Configure Databricks driver. Luckily there is an official doc for DBeaver.
Connect to the Databricks and find the table to generate SELECT statement.
Use DBeaver built-in function to generate it. See the screenshot below.
That's it!
I found this setup took just 10-15 minutes to complete saving much time.

T-SQL queries in Azure Log Analytics Workspaces?

Azure Data Explorer supposedly supports T-SQL queries:
The Kusto.Explorer tool supports T-SQL queries to Kusto. To instruct Kusto.Explorer to execute a query, begin the query with an empty T-SQL comment line (--).
However, I can't get this to work in a Log Analytics Workspace.
For instance, this Kusto query works fine and returns results:
ContainerInstanceLog_CL
| where Message has "Hamlet"
| limit 500
But any attempt to use T-SQL (with a leading empty comment line) ...
--
SELECT * FROM ContainerInstanceLog_CL
...fails with
Query could not be parsed at '-' on line [1,1]
Token: -
Line: 1
Position: 1
Are T-SQL queries not supported in Log Analytics Workspaces?
Unfortunately, you cannot run T-SQL queries in Azure Log Analytics Workspaces.
I would suggest you to provide feedback on the same:
https://feedback.azure.com/forums/267889-azure-monitor-log-analytics
All of the feedback you share in these forums will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure.
T-SQL queries run on the Azure Data Explorer:
Writing my comment as an answer as suggested.
Log Analytics Workspaces supports only Kusto as of now. You can further integrate it with power BI for better analytics options.

Azure SQL Data warehouse ADO.Net Error Codes

I just want to ask the following questions below:
Are SQL error codes in Azure SQL database will also apply in Azure SQL Data Warehouse?
Can anyone point me the URL where I can find list of error codes that's specific only from Azure SQL data warehouse?
Cheers,
Jhessie
Yes, they are the same. Reference: MSDN Forum
To view all the error messages, you can execute this query on master:
select * from sys.messages;

Azure Get Live Queries

I'm looking for a query to get the current running queries in Azure SQL. All of the T-SQL I've found do not show the running queries when I test them (for instance, run a query in one window, then look in another window at the running queries). Also, I'm not looking for anything related to the time, CPU, etc, but only the actual running query text.
When I run ...
SELECT * FROM Table --(takes 2 minutes to load)
... and run a standard information query (like from Pinal Dave or this), I don't see the above query (I assume there's another way).
select * from sys.dm_exec_requests should give you what other sessions are doing.You can join this with sys.dm_exec_sql_text to get the text if needed. sys.dm_tran_locks gives the locks hold / waiting. If this is V12 server you can also use dbcc inutbuffer. Make sure that the connection you are running is dbo / server admin