# Buggy code
def register_predictors(self, model_data_arr):
    for model_meta in model_data_arr:
        name = model_meta["name"]
        stats = model_meta["data_analysis"]
        columns_sql = ",".join(self._to_mariadb_table(stats, model_meta["predict"]))
        columns_sql += ",`select_data_query` varchar(500)"
        columns_sql += ",`external_datasource` varchar(500)"
        for col in model_meta["predict"]:
            columns_sql += f",`{col}_confidence` double"
            if model_meta["data_analysis"][col]["typing"]["data_type"] == "Numeric":
                columns_sql += f",`{col}_min` double"
                columns_sql += f",`{col}_max` double"
            columns_sql += f",`{col}_explain` varchar(500)"

        connect = self._get_connect_string(name)

        q = f"""
                    CREATE TABLE mindsdb.{name}
                    ({columns_sql}
                    ) ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='{connect}';
            """
        self._query(q)


# Traceback (Exception)
Using configuration file: config.json
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/zoran/MyProjects/mindsdb/mindsdb/__main__.py", line 61, in <module>
dbw.register_predictors(model_data_arr)
File "/home/zoran/MyProjects/mindsdb/mindsdb/interfaces/database/database.py", line 41, in register_predictors
for integration in it: integration.register_predictors(model_data_arr)
File "/home/zoran/MyProjects/mindsdb/mindsdb/integrations/clickhouse/clickhouse.py", line 115, in register_predictors
self._query(q)
File "/home/zoran/MyProjects/mindsdb/mindsdb/integrations/clickhouse/clickhouse.py", line 58, in _query
raise Exception(f'Error: {response.content}\nQuery:{query}')
Exception: Error: b'Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 51 (line 2, col 50): -class\n                    ( `Number of times pregnant` Nullable(String) , `Plasma glucose concentration` Nullable(Int64) , `Diastolic blood pressure` Nullable(. Expected one of: storage definition, ENGINE, AS, UUID, OpeningRoundBracket, ON, Dot, token (version 20.5.2.7 (official build))\n'
Query:
CREATE TABLE mindsdb.diabetes-class
( `Number of times pregnant` Nullable(String) , `Plasma glucose concentration` Nullable(Int64) , `Diastolic blood pressure` Nullable(Int64) , `Triceps skin fold thickness` Nullable(Int64) , `2-Hour serum insulin` Nullable(Int64) , `Body mass index` Nullable(Float64) , `Diabetes pedigree function` Nullable(Float64) , `Age` Nullable(Int64) , `Class` Nullable(String) , `Class_original` Nullable(String) ,`select_data_query` Nullable(String),`Class_confidence` Nullable(Float64),`Class_explain` Nullable(String)
) ENGINE=MySQL('127.0.0.1:47335', 'mindsdb', 'diabetes-class_clickhouse', 'root', 'somepass')

# Fixed code
def register_predictors(self, model_data_arr):
    for model_meta in model_data_arr:
        name = model_meta["name"]
        stats = model_meta["data_analysis"]
        columns_sql = ",".join(self._to_mariadb_table(stats, model_meta["predict"]))
        columns_sql += ",`select_data_query` varchar(500)"
        columns_sql += ",`external_datasource` varchar(500)"
        for col in model_meta["predict"]:
            columns_sql += f",`{col}_confidence` double"
            if model_meta["data_analysis"][col]["typing"]["data_type"] == "Numeric":
                columns_sql += f",`{col}_min` double"
                columns_sql += f",`{col}_max` double"
            columns_sql += f",`{col}_explain` varchar(500)"

        connect = self._get_connect_string(name)

        q = f"""
                    CREATE TABLE mindsdb.{self._escape_table_name(name)}
                    ({columns_sql}
                    ) ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='{connect}';
            """
        self._query(q)