mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-13 17:23:02 -05:00
Fixing OE database expansion read only datamarts databases (#1991)
This commit is contained in:
@@ -79,8 +79,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// IsAccessible is not set of DW Gen3 so exception is expected in this case
|
||||
if (IsDWGen3(context?.Database))
|
||||
// IsAccessible is not set of DW Gen3 and Dataverse so exception is expected in this case
|
||||
// Incase of dataverses and other TDS endpoints isAccessible creates a temp table to check if the database
|
||||
// is accessible, however these endpoints may not support ddl statements and therefore the check fails.
|
||||
if (IsDWGen3(context?.Database) || isUnknownDatabaseEdition(context?.Database))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -102,5 +104,12 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
&& db.DatabaseEngineEdition == DatabaseEngineEdition.SqlDataWarehouse
|
||||
&& db.ServerVersion.Major == 12;
|
||||
}
|
||||
|
||||
private bool isUnknownDatabaseEdition(Database db)
|
||||
{
|
||||
// If the database engine edition is not defined in the enum, it is an unknown edition
|
||||
return db != null
|
||||
&& !Enum.IsDefined(typeof(DatabaseEngineEdition), db.DatabaseEngineEdition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using System;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
||||
{
|
||||
@@ -41,7 +42,19 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
||||
/// </summary>
|
||||
public static ValidForFlag GetValidForFlag(SqlServerType serverType, Database database = null)
|
||||
{
|
||||
return GetValidForFlag(serverType, database != null && database.IsSqlDw);
|
||||
var isSqlDw = false;
|
||||
try
|
||||
{
|
||||
isSqlDw = database.IsSqlDw;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Incase of dataverses, isSqlDw creates a temp table to check if the database is accessible, however dataverse
|
||||
// don't support ddl statements and therefore this check fails.
|
||||
Logger.Information($"This exception is expected when we are trying to access a readonly database. Exception: {e.Message}");
|
||||
}
|
||||
|
||||
return GetValidForFlag(serverType, database != null && isSqlDw);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user