NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL file to create 2022 default schema

Solved!
Go to solution

I'm following along with the KB article: Logging TestStand Results to a MySQL Database Tutorial and Log Test Results to Databases with TestStand. I am attempting to generate a new MySQL schema for the logging results to a MySQL database. I've managed to get the SQL file generated, but the generated sql file seems to have some errors in it. 

 

First, the PROP_ANALOGWAVEFORM table is generated twice. 

stanxiacom_0-1693518278774.png

 

Second, the text following the "CONSTRAINT" calls is causing an error when attempting to create the table. See here when attempting to create the UUT_RESULT table:

stanxiacom_1-1693518804568.png

 

I found some KB articles and this forum post talking about looking in the %TestStand%/Components/Models/TestStandModels/Database directory for the SQL files. It seems those files don't exist for 2022. 

 

Is there something I'm missing? What is the correct procedure for generating a new MySQL database with TestStand 2022?

 

 

Environment Information

  • TestStand 2022 Q4 (22.0.0.49152) 64-bit
  • Windows 11 Pro 
  • MySQL ODBC 8.1
  • MySQL 8.0.28-0ubuntu0.20.04.3
Message 1 of 3
(741 Views)

I have also found that one of the PROP_ANALOGWAVEFORM tables is generated without a length to the VARCHAR. 

stanxiacom_0-1693569480151.png

 

0 Kudos
Message 2 of 3
(677 Views)
Solution
Accepted by topic author stan@xia.com

TL;DR: Files are in C:\Program Files\National Instruments\TestStand 2022\Components\Models\TestStandModels\Database and not in the path specified by the KB articles.

 


 

After digging through the MySQL documentation, some Stack Overflow forums (here and here), and poking at the NI Database Viewer, I found the issue.

 

I asked the Schema Validation tool to validate the schema for the MySQL Inserts. 

stanxiacom_0-1693571615553.png

Now, when I choose "Generate SQL" to "Add Missing Items". It opens up the Database Viewer. The SQL that's generated is not in a valid MySQL format. 

stanxiacom_1-1693571713049.png

This seems to be in MS Access dialect. From the forums, MySQL doesn't support inline named constraints for PRIMARY KEYs. Comments are also started with the wrong character. "//" instead of "#".

 

Now if we go to File > Open TestStand SQL Files, I find what I'm after. 

stanxiacom_3-1693571914832.png

 

Clicking on one of the files, activates the "Explore" button, which opens a file browser. The browser opens in "C:\Program Files\National Instruments\TestStand 2022\Components\Models\TestStandModels\Database".

 

Using the "recommended" path from the KB article doesn't resolve: 

stanxiacom_4-1693572155303.png


0 Kudos
Message 3 of 3
(669 Views)