We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Connection to CocroachDB is not possible


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mindsdb/integrations/postgres/postgres.py`
Content:
```
1 from contextlib import closing
2 import pg8000
3 
4 from lightwood.api import dtype
5 from mindsdb.integrations.base import Integration
6 from mindsdb.utilities.log import log
7 
8 
9 class PostgreSQLConnectionChecker:
10     def __init__(self, **kwargs):
11         self.host = kwargs.get('host')
12         self.port = kwargs.get('port')
13         self.user = kwargs.get('user')
14         self.password = kwargs.get('password')
15         self.database = kwargs.get('database', 'postgres')
16 
17     def _get_connection(self):
18         return pg8000.connect(
19             database=self.database,
20             user=self.user,
21             password=self.password,
22             host=self.host,
23             port=self.port
24         )
25 
26     def check_connection(self):
27         try:
28             con = self._get_connection()
29             with closing(con) as con:
30                 con.run('select 1;')
31             connected = True
32         except Exception:
33             connected = False
34         return connected
35 
36 
37 class PostgreSQL(Integration, PostgreSQLConnectionChecker):
38     def __init__(self, config, name, db_info):
39         super().__init__(config, name)
40         self.user = db_info.get('user')
41         self.password = db_info.get('password')
42         self.host = db_info.get('host')
43         self.port = db_info.get('port')
44         self.database = db_info.get('database', 'postgres')
45 
46     def _to_postgres_table(self, dtype_dict, predicted_cols, columns):
47         subtype_map = {
48             dtype.integer: ' int8',
49             dtype.float: 'float8',
50             dtype.binary: 'bool',
51             dtype.date: 'date',
52             dtype.datetime: 'timestamp',
53             dtype.binary: 'text',
54             dtype.categorical: 'text',
55             dtype.tags: 'text',
56             dtype.image: 'text',
57             dtype.video: 'text',
58             dtype.audio: 'text',
59             dtype.short_text: 'text',
60             dtype.rich_text: 'text',
61             dtype.array: 'text',
62             dtype.quantity: 'text',
63             dtype.tsarray: 'text',
64             'default': 'text'
65         }
66 
67         column_declaration = []
68         for name in columns:
69             try:
70                 col_subtype = dtype_dict[name]
71                 new_type = subtype_map.get(col_subtype, subtype_map.get('default'))
72                 column_declaration.append(f' "{name}" {new_type} ')
73                 if name in predicted_cols:
74                     column_declaration.append(f' "{name}_original" {new_type} ')
75             except Exception as e:
76                 log.error(f'Error: can not determine postgres data type for column {name}: {e}')
77 
78         return column_declaration
79 
80     def _escape_table_name(self, name):
81         return '"' + name.replace('"', '""') + '"'
82 
83     def _query(self, query):
84         con = self._get_connection()
85         with closing(con) as con:
86 
87             cur = con.cursor()
88             res = True
89             cur.execute(query)
90 
91             try:
92                 rows = cur.fetchall()
93                 keys = [k[0] if isinstance(k[0], str) else k[0].decode('ascii') for k in cur.description]
94                 res = [dict(zip(keys, row)) for row in rows]
95             except Exception:
96                 pass
97 
98             con.commit()
99 
100         return res
101 
102     def setup(self):
103         user = f"{self.config['api']['mysql']['user']}_{self.name}"
104         password = self.config['api']['mysql']['password']
105         host = self.config['api']['mysql']['host']
106         port = self.config['api']['mysql']['port']
107 
108         try:
109             self._query('''
110                 DO $$
111                 begin
112                     if not exists (SELECT 1 FROM pg_extension where extname = 'mysql_fdw') then
113                         CREATE EXTENSION mysql_fdw;
114                     end if;
115                 END
116                 $$;
117             ''')
118         except Exception:
119             print('Error: cant find or activate mysql_fdw extension for PostgreSQL.')
120 
121         self._query(f'DROP SCHEMA IF EXISTS {self.mindsdb_database} CASCADE')
122 
123         self._query(f"DROP USER MAPPING IF EXISTS FOR {self.user} SERVER server_{self.mindsdb_database}")
124 
125         self._query(f'DROP SERVER IF EXISTS server_{self.mindsdb_database} CASCADE')
126 
127         self._query(f'''
128             CREATE SERVER server_{self.mindsdb_database}
129                 FOREIGN DATA WRAPPER mysql_fdw
130                 OPTIONS (host '{host}', port '{port}');
131         ''')
132 
133         self._query(f'''
134            CREATE USER MAPPING FOR {self.user}
135                 SERVER server_{self.mindsdb_database}
136                 OPTIONS (username '{user}', password '{password}');
137         ''')
138 
139         self._query(f'CREATE SCHEMA {self.mindsdb_database}')
140 
141         q = f"""
142             CREATE FOREIGN TABLE IF NOT EXISTS {self.mindsdb_database}.predictors (
143                 name text,
144                 status text,
145                 accuracy text,
146                 predict text,
147                 select_data_query text,
148                 training_options text
149             )
150             SERVER server_{self.mindsdb_database}
151             OPTIONS (dbname 'mindsdb', table_name 'predictors');
152         """
153         self._query(q)
154 
155         q = f"""
156             CREATE FOREIGN TABLE IF NOT EXISTS {self.mindsdb_database}.commands (
157                 command text
158             ) SERVER server_{self.mindsdb_database}
159             OPTIONS (dbname 'mindsdb', table_name 'commands');
160         """
161         self._query(q)
162 
163     def register_predictors(self, model_data_arr):
164         for model_meta in model_data_arr:
165             name = model_meta['name']
166             predict = model_meta['predict']
167             if not isinstance(predict, list):
168                 predict = [predict]
169             columns_sql = ','.join(self._to_postgres_table(
170                 model_meta['dtype_dict'],
171                 predict,
172                 list(model_meta['dtype_dict'].keys())
173             ))
174             columns_sql += ',"select_data_query" text'
175             for col in predict:
176                 columns_sql += f',"{col}_confidence" float8'
177                 if model_meta['dtype_dict'][col] in (dtype.integer, dtype.float):
178                     columns_sql += f',"{col}_min" float8'
179                     columns_sql += f',"{col}_max" float8'
180                 columns_sql += f',"{col}_explain" text'
181 
182             self.unregister_predictor(name)
183             q = f"""
184                 CREATE FOREIGN TABLE {self.mindsdb_database}.{self._escape_table_name(name)} (
185                     {columns_sql}
186                 ) SERVER server_{self.mindsdb_database}
187                 OPTIONS (dbname 'mindsdb', table_name '{name}');
188             """
189             self._query(q)
190 
191     def unregister_predictor(self, name):
192         q = f"""
193             DROP FOREIGN TABLE IF EXISTS {self.mindsdb_database}.{self._escape_table_name(name)};
194         """
195         self._query(q)
196 
197     def get_row_count(self, query):
198         q = f"""
199             SELECT COUNT(*) as count
200             FROM ({query}) as query;
201         """
202         result = self._query(q)
203         return result[0]['count']
204 
205     def get_tables_list(self):
206         q = """
207             SELECT table_schema, table_name
208             FROM information_schema.tables
209             WHERE table_schema != 'pg_catalog'
210             AND table_schema != 'information_schema'
211             ORDER BY table_schema, table_name
212         """
213         tables_list = self._query(q)
214         tables = [f"{table['table_schema']}.{table['table_name']}" for table in tables_list]
215         return tables
216 
217     def get_columns(self, query):
218         q = f"""SELECT * from ({query}) LIMIT 1;"""
219         query_response = self._query(q)
220         if len(query_response) > 0:
221             columns = list(query_response[0].keys())
222             return columns
223         else:
224             return []
225
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mindsdb/integrations/postgres/postgres.py b/mindsdb/integrations/postgres/postgres.py
--- a/mindsdb/integrations/postgres/postgres.py
+++ b/mindsdb/integrations/postgres/postgres.py
@@ -15,12 +15,16 @@
         self.database = kwargs.get('database', 'postgres')
 
     def _get_connection(self):
+        additional_args = {}
+        if 'cockroachlabs.cloud' in self.host:
+            additional_args['ssl_context'] = True
         return pg8000.connect(
             database=self.database,
             user=self.user,
             password=self.password,
             host=self.host,
-            port=self.port
+            port=self.port,
+            **additional_args
         )
 
     def check_connection(self):

{"golden_diff": "diff --git a/mindsdb/integrations/postgres/postgres.py b/mindsdb/integrations/postgres/postgres.py\n--- a/mindsdb/integrations/postgres/postgres.py\n+++ b/mindsdb/integrations/postgres/postgres.py\n@@ -15,12 +15,16 @@\n         self.database = kwargs.get('database', 'postgres')\n \n     def _get_connection(self):\n+        additional_args = {}\n+        if 'cockroachlabs.cloud' in self.host:\n+            additional_args['ssl_context'] = True\n         return pg8000.connect(\n             database=self.database,\n             user=self.user,\n             password=self.password,\n             host=self.host,\n-            port=self.port\n+            port=self.port,\n+            **additional_args\n         )\n \n     def check_connection(self):\n", "issue": "Connection to CocroachDB is not possible\n\n", "before_files": [{"content": "from contextlib import closing\nimport pg8000\n\nfrom lightwood.api import dtype\nfrom mindsdb.integrations.base import Integration\nfrom mindsdb.utilities.log import log\n\n\nclass PostgreSQLConnectionChecker:\n    def __init__(self, **kwargs):\n        self.host = kwargs.get('host')\n        self.port = kwargs.get('port')\n        self.user = kwargs.get('user')\n        self.password = kwargs.get('password')\n        self.database = kwargs.get('database', 'postgres')\n\n    def _get_connection(self):\n        return pg8000.connect(\n            database=self.database,\n            user=self.user,\n            password=self.password,\n            host=self.host,\n            port=self.port\n        )\n\n    def check_connection(self):\n        try:\n            con = self._get_connection()\n            with closing(con) as con:\n                con.run('select 1;')\n            connected = True\n        except Exception:\n            connected = False\n        return connected\n\n\nclass PostgreSQL(Integration, PostgreSQLConnectionChecker):\n    def __init__(self, config, name, db_info):\n        super().__init__(config, name)\n        self.user = db_info.get('user')\n        self.password = db_info.get('password')\n        self.host = db_info.get('host')\n        self.port = db_info.get('port')\n        self.database = db_info.get('database', 'postgres')\n\n    def _to_postgres_table(self, dtype_dict, predicted_cols, columns):\n        subtype_map = {\n            dtype.integer: ' int8',\n            dtype.float: 'float8',\n            dtype.binary: 'bool',\n            dtype.date: 'date',\n            dtype.datetime: 'timestamp',\n            dtype.binary: 'text',\n            dtype.categorical: 'text',\n            dtype.tags: 'text',\n            dtype.image: 'text',\n            dtype.video: 'text',\n            dtype.audio: 'text',\n            dtype.short_text: 'text',\n            dtype.rich_text: 'text',\n            dtype.array: 'text',\n            dtype.quantity: 'text',\n            dtype.tsarray: 'text',\n            'default': 'text'\n        }\n\n        column_declaration = []\n        for name in columns:\n            try:\n                col_subtype = dtype_dict[name]\n                new_type = subtype_map.get(col_subtype, subtype_map.get('default'))\n                column_declaration.append(f' \"{name}\" {new_type} ')\n                if name in predicted_cols:\n                    column_declaration.append(f' \"{name}_original\" {new_type} ')\n            except Exception as e:\n                log.error(f'Error: can not determine postgres data type for column {name}: {e}')\n\n        return column_declaration\n\n    def _escape_table_name(self, name):\n        return '\"' + name.replace('\"', '\"\"') + '\"'\n\n    def _query(self, query):\n        con = self._get_connection()\n        with closing(con) as con:\n\n            cur = con.cursor()\n            res = True\n            cur.execute(query)\n\n            try:\n                rows = cur.fetchall()\n                keys = [k[0] if isinstance(k[0], str) else k[0].decode('ascii') for k in cur.description]\n                res = [dict(zip(keys, row)) for row in rows]\n            except Exception:\n                pass\n\n            con.commit()\n\n        return res\n\n    def setup(self):\n        user = f\"{self.config['api']['mysql']['user']}_{self.name}\"\n        password = self.config['api']['mysql']['password']\n        host = self.config['api']['mysql']['host']\n        port = self.config['api']['mysql']['port']\n\n        try:\n            self._query('''\n                DO $$\n                begin\n                    if not exists (SELECT 1 FROM pg_extension where extname = 'mysql_fdw') then\n                        CREATE EXTENSION mysql_fdw;\n                    end if;\n                END\n                $$;\n            ''')\n        except Exception:\n            print('Error: cant find or activate mysql_fdw extension for PostgreSQL.')\n\n        self._query(f'DROP SCHEMA IF EXISTS {self.mindsdb_database} CASCADE')\n\n        self._query(f\"DROP USER MAPPING IF EXISTS FOR {self.user} SERVER server_{self.mindsdb_database}\")\n\n        self._query(f'DROP SERVER IF EXISTS server_{self.mindsdb_database} CASCADE')\n\n        self._query(f'''\n            CREATE SERVER server_{self.mindsdb_database}\n                FOREIGN DATA WRAPPER mysql_fdw\n                OPTIONS (host '{host}', port '{port}');\n        ''')\n\n        self._query(f'''\n           CREATE USER MAPPING FOR {self.user}\n                SERVER server_{self.mindsdb_database}\n                OPTIONS (username '{user}', password '{password}');\n        ''')\n\n        self._query(f'CREATE SCHEMA {self.mindsdb_database}')\n\n        q = f\"\"\"\n            CREATE FOREIGN TABLE IF NOT EXISTS {self.mindsdb_database}.predictors (\n                name text,\n                status text,\n                accuracy text,\n                predict text,\n                select_data_query text,\n                training_options text\n            )\n            SERVER server_{self.mindsdb_database}\n            OPTIONS (dbname 'mindsdb', table_name 'predictors');\n        \"\"\"\n        self._query(q)\n\n        q = f\"\"\"\n            CREATE FOREIGN TABLE IF NOT EXISTS {self.mindsdb_database}.commands (\n                command text\n            ) SERVER server_{self.mindsdb_database}\n            OPTIONS (dbname 'mindsdb', table_name 'commands');\n        \"\"\"\n        self._query(q)\n\n    def register_predictors(self, model_data_arr):\n        for model_meta in model_data_arr:\n            name = model_meta['name']\n            predict = model_meta['predict']\n            if not isinstance(predict, list):\n                predict = [predict]\n            columns_sql = ','.join(self._to_postgres_table(\n                model_meta['dtype_dict'],\n                predict,\n                list(model_meta['dtype_dict'].keys())\n            ))\n            columns_sql += ',\"select_data_query\" text'\n            for col in predict:\n                columns_sql += f',\"{col}_confidence\" float8'\n                if model_meta['dtype_dict'][col] in (dtype.integer, dtype.float):\n                    columns_sql += f',\"{col}_min\" float8'\n                    columns_sql += f',\"{col}_max\" float8'\n                columns_sql += f',\"{col}_explain\" text'\n\n            self.unregister_predictor(name)\n            q = f\"\"\"\n                CREATE FOREIGN TABLE {self.mindsdb_database}.{self._escape_table_name(name)} (\n                    {columns_sql}\n                ) SERVER server_{self.mindsdb_database}\n                OPTIONS (dbname 'mindsdb', table_name '{name}');\n            \"\"\"\n            self._query(q)\n\n    def unregister_predictor(self, name):\n        q = f\"\"\"\n            DROP FOREIGN TABLE IF EXISTS {self.mindsdb_database}.{self._escape_table_name(name)};\n        \"\"\"\n        self._query(q)\n\n    def get_row_count(self, query):\n        q = f\"\"\"\n            SELECT COUNT(*) as count\n            FROM ({query}) as query;\n        \"\"\"\n        result = self._query(q)\n        return result[0]['count']\n\n    def get_tables_list(self):\n        q = \"\"\"\n            SELECT table_schema, table_name\n            FROM information_schema.tables\n            WHERE table_schema != 'pg_catalog'\n            AND table_schema != 'information_schema'\n            ORDER BY table_schema, table_name\n        \"\"\"\n        tables_list = self._query(q)\n        tables = [f\"{table['table_schema']}.{table['table_name']}\" for table in tables_list]\n        return tables\n\n    def get_columns(self, query):\n        q = f\"\"\"SELECT * from ({query}) LIMIT 1;\"\"\"\n        query_response = self._query(q)\n        if len(query_response) > 0:\n            columns = list(query_response[0].keys())\n            return columns\n        else:\n            return []\n", "path": "mindsdb/integrations/postgres/postgres.py"}], "after_files": [{"content": "from contextlib import closing\nimport pg8000\n\nfrom lightwood.api import dtype\nfrom mindsdb.integrations.base import Integration\nfrom mindsdb.utilities.log import log\n\n\nclass PostgreSQLConnectionChecker:\n    def __init__(self, **kwargs):\n        self.host = kwargs.get('host')\n        self.port = kwargs.get('port')\n        self.user = kwargs.get('user')\n        self.password = kwargs.get('password')\n        self.database = kwargs.get('database', 'postgres')\n\n    def _get_connection(self):\n        additional_args = {}\n        if 'cockroachlabs.cloud' in self.host:\n            additional_args['ssl_context'] = True\n        return pg8000.connect(\n            database=self.database,\n            user=self.user,\n            password=self.password,\n            host=self.host,\n            port=self.port,\n            **additional_args\n        )\n\n    def check_connection(self):\n        try:\n            con = self._get_connection()\n            with closing(con) as con:\n                con.run('select 1;')\n            connected = True\n        except Exception:\n            connected = False\n        return connected\n\n\nclass PostgreSQL(Integration, PostgreSQLConnectionChecker):\n    def __init__(self, config, name, db_info):\n        super().__init__(config, name)\n        self.user = db_info.get('user')\n        self.password = db_info.get('password')\n        self.host = db_info.get('host')\n        self.port = db_info.get('port')\n        self.database = db_info.get('database', 'postgres')\n\n    def _to_postgres_table(self, dtype_dict, predicted_cols, columns):\n        subtype_map = {\n            dtype.integer: ' int8',\n            dtype.float: 'float8',\n            dtype.binary: 'bool',\n            dtype.date: 'date',\n            dtype.datetime: 'timestamp',\n            dtype.binary: 'text',\n            dtype.categorical: 'text',\n            dtype.tags: 'text',\n            dtype.image: 'text',\n            dtype.video: 'text',\n            dtype.audio: 'text',\n            dtype.short_text: 'text',\n            dtype.rich_text: 'text',\n            dtype.array: 'text',\n            dtype.quantity: 'text',\n            dtype.tsarray: 'text',\n            'default': 'text'\n        }\n\n        column_declaration = []\n        for name in columns:\n            try:\n                col_subtype = dtype_dict[name]\n                new_type = subtype_map.get(col_subtype, subtype_map.get('default'))\n                column_declaration.append(f' \"{name}\" {new_type} ')\n                if name in predicted_cols:\n                    column_declaration.append(f' \"{name}_original\" {new_type} ')\n            except Exception as e:\n                log.error(f'Error: can not determine postgres data type for column {name}: {e}')\n\n        return column_declaration\n\n    def _escape_table_name(self, name):\n        return '\"' + name.replace('\"', '\"\"') + '\"'\n\n    def _query(self, query):\n        con = self._get_connection()\n        with closing(con) as con:\n\n            cur = con.cursor()\n            res = True\n            cur.execute(query)\n\n            try:\n                rows = cur.fetchall()\n                keys = [k[0] if isinstance(k[0], str) else k[0].decode('ascii') for k in cur.description]\n                res = [dict(zip(keys, row)) for row in rows]\n            except Exception:\n                pass\n\n            con.commit()\n\n        return res\n\n    def setup(self):\n        user = f\"{self.config['api']['mysql']['user']}_{self.name}\"\n        password = self.config['api']['mysql']['password']\n        host = self.config['api']['mysql']['host']\n        port = self.config['api']['mysql']['port']\n\n        try:\n            self._query('''\n                DO $$\n                begin\n                    if not exists (SELECT 1 FROM pg_extension where extname = 'mysql_fdw') then\n                        CREATE EXTENSION mysql_fdw;\n                    end if;\n                END\n                $$;\n            ''')\n        except Exception:\n            print('Error: cant find or activate mysql_fdw extension for PostgreSQL.')\n\n        self._query(f'DROP SCHEMA IF EXISTS {self.mindsdb_database} CASCADE')\n\n        self._query(f\"DROP USER MAPPING IF EXISTS FOR {self.user} SERVER server_{self.mindsdb_database}\")\n\n        self._query(f'DROP SERVER IF EXISTS server_{self.mindsdb_database} CASCADE')\n\n        self._query(f'''\n            CREATE SERVER server_{self.mindsdb_database}\n                FOREIGN DATA WRAPPER mysql_fdw\n                OPTIONS (host '{host}', port '{port}');\n        ''')\n\n        self._query(f'''\n           CREATE USER MAPPING FOR {self.user}\n                SERVER server_{self.mindsdb_database}\n                OPTIONS (username '{user}', password '{password}');\n        ''')\n\n        self._query(f'CREATE SCHEMA {self.mindsdb_database}')\n\n        q = f\"\"\"\n            CREATE FOREIGN TABLE IF NOT EXISTS {self.mindsdb_database}.predictors (\n                name text,\n                status text,\n                accuracy text,\n                predict text,\n                select_data_query text,\n                training_options text\n            )\n            SERVER server_{self.mindsdb_database}\n            OPTIONS (dbname 'mindsdb', table_name 'predictors');\n        \"\"\"\n        self._query(q)\n\n        q = f\"\"\"\n            CREATE FOREIGN TABLE IF NOT EXISTS {self.mindsdb_database}.commands (\n                command text\n            ) SERVER server_{self.mindsdb_database}\n            OPTIONS (dbname 'mindsdb', table_name 'commands');\n        \"\"\"\n        self._query(q)\n\n    def register_predictors(self, model_data_arr):\n        for model_meta in model_data_arr:\n            name = model_meta['name']\n            predict = model_meta['predict']\n            if not isinstance(predict, list):\n                predict = [predict]\n            columns_sql = ','.join(self._to_postgres_table(\n                model_meta['dtype_dict'],\n                predict,\n                list(model_meta['dtype_dict'].keys())\n            ))\n            columns_sql += ',\"select_data_query\" text'\n            for col in predict:\n                columns_sql += f',\"{col}_confidence\" float8'\n                if model_meta['dtype_dict'][col] in (dtype.integer, dtype.float):\n                    columns_sql += f',\"{col}_min\" float8'\n                    columns_sql += f',\"{col}_max\" float8'\n                columns_sql += f',\"{col}_explain\" text'\n\n            self.unregister_predictor(name)\n            q = f\"\"\"\n                CREATE FOREIGN TABLE {self.mindsdb_database}.{self._escape_table_name(name)} (\n                    {columns_sql}\n                ) SERVER server_{self.mindsdb_database}\n                OPTIONS (dbname 'mindsdb', table_name '{name}');\n            \"\"\"\n            self._query(q)\n\n    def unregister_predictor(self, name):\n        q = f\"\"\"\n            DROP FOREIGN TABLE IF EXISTS {self.mindsdb_database}.{self._escape_table_name(name)};\n        \"\"\"\n        self._query(q)\n\n    def get_row_count(self, query):\n        q = f\"\"\"\n            SELECT COUNT(*) as count\n            FROM ({query}) as query;\n        \"\"\"\n        result = self._query(q)\n        return result[0]['count']\n\n    def get_tables_list(self):\n        q = \"\"\"\n            SELECT table_schema, table_name\n            FROM information_schema.tables\n            WHERE table_schema != 'pg_catalog'\n            AND table_schema != 'information_schema'\n            ORDER BY table_schema, table_name\n        \"\"\"\n        tables_list = self._query(q)\n        tables = [f\"{table['table_schema']}.{table['table_name']}\" for table in tables_list]\n        return tables\n\n    def get_columns(self, query):\n        q = f\"\"\"SELECT * from ({query}) LIMIT 1;\"\"\"\n        query_response = self._query(q)\n        if len(query_response) > 0:\n            columns = list(query_response[0].keys())\n            return columns\n        else:\n            return []\n", "path": "mindsdb/integrations/postgres/postgres.py"}]}