DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

ScriptDom can't parse CREATE DATABASE ... ELASTIC_POOL

Open taspeotis opened this issue 3 years ago • 3 comments

ScriptDom doesn't understand SQL Azure Elastic Pools.

  • SqlPackage or DacFx Version: 160.5400.1
  • .NET Framework (Windows-only) or .NET Core: 6.0.101
  • Environment (local platform and source/target platforms): SQL Azure

Steps to Reproduce:

You can take this example CREATE DATABASE statement from the documentation for reproduction:

const string sql = "CREATE DATABASE db1 ( SERVICE_OBJECTIVE = ELASTIC_POOL ( name = S3M100 ) ) ;";
using var stringReader = new StringReader(sql);
var parser = new TSql160Parser(true, SqlEngineType.All);
var fragment = parser.Parse(stringReader, out var errors);

errors now contains one error: Incorrect syntax near ELASTIC_POOL. I tried SqlEngineType.SqlAzure but the result was the same.

SQL Azure parses it:

image

And if I try to execute it, it runs.

taspeotis avatar Feb 20 '22 11:02 taspeotis

DacFx does not support elastic pools, as mentioned in the limitations for bacpacs. The workaround is to create a single database for DacFx operations, then move the database into an elastic pool.

kisantia avatar Mar 01 '22 20:03 kisantia

Thanks for the reply.

Are ScriptDom and BACPACs intertwined? Because I am trying to parse Transact-SQL, not do anything with a BACPAC. I was under the impression ScriptDom stood apart from DacFx things.

If ScriptDom exists exclusively for BACPACs then I can understand this is not a bug and rather a feature request.

taspeotis avatar Mar 02 '22 03:03 taspeotis

@taspeotis - ScriptDom is not exclusively for BACPAC operations. Conceptually, we should be supporting this syntax in ScriptDom.

CC: @yualan @dzsquared

arvindshmicrosoft avatar Mar 02 '22 17:03 arvindshmicrosoft