Well I gave up on the whole script things as I thought I'd need to invest quite a bit of time to find out how to do it ... instead I wrote a little program, that generates a json file that has a configurable number of historian tags in them. With this I was able to test my Apache IoTDB historian with 161000 tags ... guess when importing another 500000 I was a bit greedy ... now the UI application doesn't seem to like me anymore 
Here's the code for my little tool:
package com.timecho.iotdb.ignition.tools.taggenerator;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Random;
public class TagGenerator {
static Device[] devices = {
new Device("Realistic0", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic0", "Float8", "Ignition OPC UA Server"),
new Device("Realistic1", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic1", "Float8", "Ignition OPC UA Server"),
new Device("Realistic2", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic2", "Float8", "Ignition OPC UA Server"),
new Device("Realistic3", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic3", "Float8", "Ignition OPC UA Server"),
new Device("Realistic4", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic4", "Float8", "Ignition OPC UA Server"),
new Device("Realistic5", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic5", "Float8", "Ignition OPC UA Server"),
new Device("Realistic6", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic6", "Float8", "Ignition OPC UA Server"),
new Device("Realistic7", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic7", "Float8", "Ignition OPC UA Server"),
new Device("Realistic8", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic8", "Float8", "Ignition OPC UA Server"),
new Device("Realistic9", "AtomicTag", "opc", "ns=1;s=[Sample_Device]_Meta:Realistic/Realistic9", "Float8", "Ignition OPC UA Server")
};
public static void main(String[] args) throws Exception {
Random random = new Random();
if(args.length < 2 || args.length > 3) {
System.out.println("Usage: TagGenerator {num-total-tags} {num-tags-per-folder} ({output-file-name})");
}
int numTags = Integer.parseInt(args[0]);
int numTagsForFolder = Integer.parseInt(args[1]);
PrintStream out = System.out;
if(args.length == 3) {
out = new PrintStream(Files.newOutputStream(Paths.get(args[2])));
}
int folderIndex = 0;
out.printf(
"{\n" +
" \"tags\": [\n" +
" {\n" +
" \"name\": \"Benchmark%08d\",\n" +
" \"tagType\": \"Folder\",\n" +
" \"tags\": [\n", folderIndex);
int curNumTagsInFolder = 0;
for(int i = 0; i < numTags; i++) {
int deviceIndex = random.nextInt(10);
Device curDevice = devices[deviceIndex];
out.printf(" {\n" +
" \"valueSource\": \"%s\",\n" +
" \"opcItemPath\": \"%s\",\n" +
" \"dataType\": \"%s\",\n" +
" \"historyProvider\": \"Apache IoTDB History Provider\",\n" +
" \"name\": \"BenchmarkTag%08d\",\n" +
" \"historyEnabled\": true,\n" +
" \"tagType\": \"%s\",\n" +
" \"opcServer\": \"%s\"\n" +
" }%s\n", curDevice.getValueSource(), curDevice.getOpcItemPath(), curDevice.getDataType(),
curNumTagsInFolder,
curDevice.getTagType(), curDevice.getOpcServer(),
(curNumTagsInFolder == numTagsForFolder || i == (numTags - 1)) ? "" : ",");
curNumTagsInFolder++;
if(curNumTagsInFolder > numTagsForFolder) {
curNumTagsInFolder = 0;
folderIndex++;
out.printf(
" ]\n" +
" },\n" +
" {\n" +
" \"name\": \"Benchmark%08d\",\n" +
" \"tagType\": \"Folder\",\n" +
" \"tags\": [\n", folderIndex);
}
}
out.print(
" ]\n" +
" }\n" +
" ]\n" +
"}\n");
if(out != System.out) {
out.flush();
out.close();
}
}
}
It's not super battle proven ... I guess there are probably edge-cases, that make it produce invalid JSON, but I didn't run into any issues.