0

Does Dbup support the azure datawarehouse DB? When i tried to run the c# console project, even for select statement, i am getting the below error, any advice appreciated? is there any alternative sql automation version like dbup, apart from dacpac.

[error]Script block number: -1; Message: Enforced unique constraints are not supported in Azure SQL Data Warehouse. To create an unenforced unique constraint you must include the NOT ENFORCED syntax as part of your statement.

[error]System.Data.SqlClient.SqlException (0x80131904): Enforced unique constraints are not supported in Azure SQL Data Warehouse. To create an unenforced unique constraint you must include the NOT ENFORCED syntax as part of your statement.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
program.cs
``
using DbUp;
using System;``
using System.Configuration;
using System.Reflection;

namespace  MIReport.Warehouse
{
    class Program
    {
        static int Main(string[] args)
        {
            var connectionString = @"Server=tcp:" + args[0] + ",1433;Initial Catalog=" + args[1] + ";Persist Security Info=False;User ID=" + args[2] + ";Password=" + args[3] + ";MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Authentication='Active Directory Password';";

            var upgrader = DeployChanges.To
                .SqlDatabase(connectionString)
                .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
                .LogToConsole()
                .LogScriptOutput()
                .Build();

            var result = upgrader.PerformUpgrade();

            if (!result.Successful)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(result.Error);
                Console.ResetColor();
                return -1;
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Success!");
            Console.ResetColor();
            return 0;
        }
    }
}
baba
  • 31
  • 2
  • Please add relevant code example to your question,it's much easier to help if we can take a look at the code that produced this error – SteapStepper69 Mar 25 '20 at 06:21
  • Not sure about Dbup, but Visual Studio 2019 now supports database project for Azure SQL Data Warehouse. See here: https://cloudblogs.microsoft.com/sqlserver/2019/11/07/new-in-azure-synapse-analytics-cicd-for-sql-analytics-using-sql-server-data-tools/ – wBob Mar 25 '20 at 17:13
  • @Max: code Added i.e program.cs – baba Mar 25 '20 at 18:41
  • We want sql script deployment because of limited user privs. For Visual studio dacpac requires admin privs for deploy. – baba Mar 25 '20 at 18:43

0 Answers0