Can I create a stored procedure in serverless sql pool - azure

Following the official documentation from Microsoft, it is possible to create a stored procedure in Azure Synapse Serverless SQL pool. I manage to execute the following script
Create proc Test
as
Select 1 as X
However, I Don't see the Test stored procedure in the Serverless SQL pool.
I don't also see the programmability folder in the Serverless SQL pool

The only way I've found to view the Stored Procedure in Synapse Studio or Azure Data Studio is to query the sys schema tables. However SPs are visible if you use SSMS via steps here https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/get-started-ssms
Query in Synapse Studio
SELECT definition, uses_ansi_nulls, uses_quoted_identifier, is_schema_bound
FROM sys.sql_modules
WHERE object_id = OBJECT_ID('dbo.Test');
GO
SSMS

Related

How can I make tables from serverless Azure Synapse views?

I have a view in an on-demand (or "serverless") sql pool. My goal is to over data from the serverless views and materialize them as tables in the dedicated pool. Is this possible?
There are a couple of options here:
create a Synapse Pipeline with Copy activity. Use the serverless and the source and the dedicated sql pool as the sink. Make sure the 'Auto create table' option is set on the sink
create a Synapse notebook that connects via jdbc to the serverless sql pool (it's just a sql endpoint right), and writes into dedicated sql pool via the synapsesql.write method. I did an example of that technique here.
As per the official Microsoft documentation:
Limitations
Views in Synapse SQL are only stored as metadata. Consequently, the following options aren't available:
There isn't a schema binding option
Base tables can't be updated through the view
Views can't be created over temporary tables
There's no support for the EXPAND / NOEXPAND hints
There are no indexed views in Synapse SQL
But, as an alternative, if your table is in dedicated SQL pool you can use CREATE TABLE AS SELECT (CTAS) that creates a new table based on the output of a SELECT statement. CTAS is the simplest and fastest way to create a copy of a table.
To know more, please refer CREATE TABLE AS SELECT (Azure Synapse Analytics).

Azure Synapse dedicated sql pool not showing data objects in synapse studio

I am working on Tutorial 4 of this doc from Azure Team where this section in a Dedicated SQL pool (that actually is also a database - as item 2 of Tutorial states) creates a database named nyctaxi with a table nyctaxi.trip as follows:
%%pyspark
spark.sql("CREATE DATABASE IF NOT EXISTS nyctaxi")
df.write.mode("overwrite").saveAsTable("nyctaxi.trip")
Then Tutorial 5 creates another table NYCTaxiTripSmall. After completing these tutorials, I can see (on the Data Hub of the Synapse studio) my Dedicated SQL Pool as shown below. But when I click on any database object folder it does not show any db object (tables, external tables etc.) and instead, it shows a red cross sign (as shown below).
Question: Why I am not seeing the db objects (described above) in the Dedicated SQL pool below.
Remarks: Please note that I also created DataExplorationDB db and an external source in tutorial 2 using serverless SQL pool - and, as shown in yellow below, I can see that db and its objects. So why same is not true for Dedicated SQL Pool db? I have also restarted the Dedicated SQL pool and it's online. But still no db objects are showing.
When you create a Spark database the tables aren't automatically added to your Dedicated SQL Pool. You can add them as External Tables if you want, but there's no automatic metadata sync between Spark and Dedicated SQL Pool.
Synapse does create a serverless "Lake Database" corresponding to your Spark database, which you can use from SQL Scripts or access with SQL Server reporting tools.

Is there any equivalent is there for 'sp_refreshview' in Azure Synapse Dedicated SQL Pool

Is there any equivalent is available for 'sp_refreshview' in Azure Synapse Dedicated SQL Pool?
When i tried , it shows below error.
Since VIEWS WONT GET UPDATED AUTOMATICALLY, is there any other command or system stored procedure available in Azure Synapse Analytics's Dedicated SQL Pool other than 'ALTER VIEW' Approach?
Try this:
EXEC sys.sp_refreshsqlmodule 'dbo.YourViewName';
See the documentation here.

How to import a local SQL database back-up file to an Azure SQL server database?

I have a project that is running on a local SQLExpress server. I have exported my database to a .bacpac file.
I am trying to restore that DB to an Azure SQL server. So what I am trying to do is to create a DB on Azure using this back-up file.
How can I do that?
The easiest way to migrate a database to Azure SQL Database is using Data Migration Assistant (DMA). This tool performs an assessment first to verify the database does not use incompatible statements with Azure SQL Database, and it also migrate the schema and/or the data, as you wish. Download it from here.
I imported it through SSMS by connecting to my Azure SQL server and doing import data-tier application

Upload SQL Database and its Data to Azure

I created an SQL database using ASP.NET Core 1.1 Migrations.
After I created the database I added some data to the database.
What options do I have to upload this database to Azure?
I need to send the Scheme and the initial data.
Is it possible to run Entity Framework migrations on Azure?
This article describes the possibilities to migrate an existing database to SQL Azure.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate
However, in your scenario, this might be overkill to go through the steps of realy doing a migration.
If your number of tables and data is rather small, why not create a SQL script to create the tables & insert the data?
Connect to your SQL Azure using SQL Server Management Studio and execute the script.
As for the Entity Framework, yes, you can run those on SQL Azure as well.

Resources