EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB483540: Unified Quoting Behavior for Warehouse Identifiers in MicroStrategy 2021


Qinyi Chen

Quality Engineer, Principal • Strategy


In MicroStrategy 2021, there is now a way to unify the quoting behavior for a variety of warehouse identifiers and keep backward compatibility.

Summary 

Have you ever had a query fail to execute because of a space or a dot in your new table name? Have you ever migrated your data from Excel to MySQL and then were unable to access it the same way? Have you ever been confused about the different VLDB properties and patterns? Perhaps not knowing how to add a pair of square brackets to your column alias? Different databases have different ways to quote their identifiers. In Strategy 2021, Unified Quoting, that can help in all of the above situations. 

Glossary 

Identifiers 
Identifier is a term used to refer to a database object name. In our case, it includes, but is not limited to, table names, table aliases, column names, database names, and namespace/schema names. 
VLDB Properties 
VLDB properties allow you to customize the SQL that Strategy generates. These settings affect how Strategy Intelligence Server generate queries. For more information on VLDB properties, see SQL Generation and Data Processing: VLDB Properties.  
Pattern 
Pattern is the way we define our query generation behavior. For example, if we want to quote 

select colname from t1
 as 
select [colname] from [t1]
, we would assign the quoting pattern [#0]. The #0 is the identifier that we are quoting. 

Content 

Current Quoting Pattern Challenges in SQL 

When working with Structured Query Language, or SQL, you must be precise with your naming and formatting. Even an extra space in your query can cause it to fail. For example, if you create a query that says

 select colname from t1
, but the column name is actually col name, with a space, the query becomes 
select col name from t1
. This query could fail because the database interprets the query as “get the column named ‘
col
’ and alias it as ‘
name
,’” instead of “get the column named ‘
col name
.’” If there is no column named 
col
 in t1, the query will fail. 
There are a variety of VLDB properties that can assist in situations like this. For example, if you set the VLDB property Space In Columnname Pattern to “#0”, it would parse the query as select “col name” from t1, allowing the database to interpret the SQL correctly.  
Although VLDB properties can assist in numerous quoting pattern situations, there are now so many options that it’s become challenging to keep track of the options and how to use them. For example, if a table name contains a space and an uppercase character, do you use Space In Tablename Pattern or Uppercase In Columnname Pattern? 
To avoid situations like this, Strategy 2021 introduces a new feature that will apply the correct quotes to all identifiers. So instead of 
select “col name” from t1
, it will generate select “col name” from “t1.” 

Unified Quoting: Solutions to Quoting Pattern Challenges 

There are now two new VLDB properties that control quoting behavior. 

  1. Quoting Behavior is a setting created to control whether a project uses unified quoting. When it’s set to 1, the project uses unified quoting. When it’s set to 0, the project does not use unified quoting. 
  1. Unified Quoting Pattern is a setting created to control how a specific DBMS or database instance quote queries that run against it. Unlike Quoting Behavior, which is an on/off switch,  Unified Quoting Pattern is a string pattern.   

For example, the chart below illustrate how these two settings work together to control how queries are generated with or without quotations. 

ka0PW0000000wiLYAQ_0EM2R000000lca7.jpeg

This example assumes the metadata includes three projects that are using three different database instances with different DBMS and using different quoting patterns. The quoting patterns used are [#0], ‘#0’, and default, which is #0. 
Project 1 has Quoting Behavior enabled. Project 1 has Report 1 that uses DB instance 1, where the pattern is [#0], therefore, Report 1 will be quoted [#0]. Report 2 uses DB instance 2, where the patterns is ‘#0', therefore, Report 2 will be quoted '#0'. 
Project 2 has Quoting Behavior disabled, therefore, no matter what DB instance its reports are using, the queries will not be quoted. 
Project 3 has Quoting Behavior enabled. Project 3 has Report 1 that uses DB instance 2, where the pattern is ‘#0', therefore, Report 1 will be quoted '#0'. Report 2 uses DB instance 3, where there is no pattern, therefore, Report 2 will be not be quoted. 

Benefits 

  • Analysts will no longer get a broken query when importing data from tables that contain spaces or other special characters in its name. 
  • Analysts have more flexibility in creating their metric names and aliases. 
  • BI administrators are relieved from managing different VLDB properties in different database instances. 
  • Data Warehouse Engineers have more flexibility in naming their tables and columns. Previously, users couldn’t name their tables with SQL Reserve Words, e.g., “table” can’t be the name of your table or column. With proper quoting, this limitation is removed. 
  • The queries generated are more consistently quoted. 

How to Implement Unified Quoting Behavior 

  1. Set the Data Engine Version to 12 to enable this feature.  For more details on enabling the setting, see Change Data Engine Version.

Supported DBMS 

  • MySQL 5.x 
  • MySQL 8.x  
  • Oracle 11gR2 
  • Oracle 12c  
  • Oracle 12cR2  
  • Oracle 18c 
  • Oracle 19c 
  • Microsoft SQL Server 2008 R2 
  • Microsoft SQL Server 2012  
  • Microsoft SQL Server 2014  
  • Microsoft SQL Server 2016  
  • Microsoft SQL Server 2017  
  • Microsoft SQL Server 2019 
  • Teradata 15.10  
  • Teradata 16.x  
  • SAP HANA 1.x  
  • SAP HANA 2.x  
  • IBM Db2  
  • Salesforce  
  • Amazon Redshift  
  • Azure SQL Data Warehouse 
  • MongoDB 3.x
  • MongoDB BI Connector 

Limitation 

  • Freeform SQL 

There are several ways to manually input the query to suit your own purpose. For example, Type a Query in Web Data Import, Pre/Post Statements, and Logic Table View. In these situations, Strategy will not do perform any modifications on it. If any freeform SQL breaks a query, it’s recommended to update your freeform SQL. An example can be found here .

  • Identifier names contain pattern characters 

Any identifiers containing pattern characters, like “, will fail.  

  • Generated table names, mostly for temp table names, will not have quotations since they should not contain special characters.  
  • Affect Integrity Manager result by reordering columns 

Using Integrity Manager to compare SQL with and without Unified Quoting turned on will reorder of columns.  
For example: 
Before quote: 

Select * from ##ZZNB00 pa11 

join ##ZZMB01 pa12 

on  ( pa11. COL _Id = pa12.COL_Id and  

 pa11.COL_Id0 = pa12.WJXBFS1) 

After quote: 
Select * from ##ZZNB00 [pa11]           /*Expect unquoted temp table names*/  join ##ZZMB01 [pa12] on  ( [pa11].[COL_Id0] = [pa12].[WJXBFS1] and  [pa11].[COL_Id] = [pa12].[COL_Id]) 

  • Case sensitivity issue due to warehouse migration

During warehouse migration, if the existing warehouse table and column cases are not kept in the destination/new warehouse, user may see errors related to "table or view does not exist" when unified quoting is enabled. Please take a look at this article for potential workaround. 
The Strategy Internal Reference Number for the issue discussed is KB483540 and F11007.


Comment

0 comments

Details

Knowledge Article

Published:

August 9, 2019

Last Updated:

February 26, 2024