func (d *DBGenerator) connect(ctx context.Context) error {
	if d.Conn == nil {
		connStr := fmt.Sprintf("vertica://%s:%s@%s:%d/%s?tlsmode=%s",
			d.Opts.User, d.Opts.Password, d.Opts.Host, d.Opts.Port, d.Opts.DBName, d.Opts.TLSMode,
		)
		conn, err := sql.Open("vertica", connStr)
		if err != nil {
			return err
		}
		d.Conn = conn
	}
	return d.Conn.PingContext(ctx)
}
connect will establish a connect to the database
package vdbgen
import (
	"context"
	"database/sql"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"regexp"
	"strings"
	_ "github.com/vertica/vertica-sql-go"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	vapi "github.com/vertica/vertica-kubernetes/api/v1beta1"
	"github.com/vertica/vertica-kubernetes/pkg/controllers"
	"github.com/vertica/vertica-kubernetes/pkg/paths"
)
type DBGenerator struct {
	Conn           *sql.DB
	Opts           *Options
	Objs           KObjs
	LicenseData    []byte
	DBCfg          map[string]string  
	CAFileData     []byte
	HadoopConfData map[string]string
}
type QueryType string
const (
	ShardCountKey      QueryType = "shardCount"
	DBCfgKey           QueryType = "dbCfg"
	StorageLocationKey QueryType = "storageLocation"
	SubclusterQueryKey QueryType = "subcluster"
	SecretAPIVersion = "v1"
	SecretKindName   = "Secret"
	ConfigAPIVersion = "v1"
	ConfigKindName   = "ConfigMap"
)
var Queries = map[QueryType]string{
	ShardCountKey:      "SELECT COUNT(*) FROM SHARDS WHERE SHARD_TYPE != 'Replica'",
	DBCfgKey:           "SHOW DATABASE DEFAULT ALL",
	StorageLocationKey: "SELECT NODE_NAME, LOCATION_PATH FROM STORAGE_LOCATIONS WHERE LOCATION_USAGE = ?",
	SubclusterQueryKey: "SELECT SUBCLUSTER_NAME, IS_PRIMARY FROM SUBCLUSTERS ORDER BY NODE_NAME",
}
func (d *DBGenerator) Create() (*KObjs, error) {
	ctx := context.Background()
	d.setParmsFromOptions()
	collectors := []func(ctx context.Context) error{
		d.readLicense,
		d.connect,
		d.setShardCount,
		d.setCommunalPath,
		d.fetchDatabaseConfig,
		d.setCommunalEndpointAWS,
		d.setCommunalEndpointGCloud,
		d.setCommunalEndpointAzure,
		d.setLocalPaths,
		d.setSubclusterDetail,
		d.setLicense,
		d.setPasswordSecret,
		d.readCAFile,
		d.setCAFile,
		d.readHadoopConfig,
		d.setHadoopConfig,
	}
	for _, collector := range collectors {
		if err := collector(ctx); err != nil {
			return nil, err
		}
	}
	return &d.Objs, nil
}