WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: spl on November 04, 2025, 12:52:59 PM

Title: AI schema
Post by: spl on November 04, 2025, 12:52:59 PM
Been interested and recently approached about creating a chatbot for SaaS PowerBI App [back end would be PostGRE]. Anyway, as most already know AI is only about as good as the data it recognizes for query results based on natural language queries. So, below sorts out some popular db's based on whether or not they support the INFORMATION_SCHEMA structure, in which case a simple/standard query could collect a schema to be fed to AI.
;gets schema information for databases supporting INFORMATION_SCHEMA
;requires connectionstring to server/db
qry = $"
SELECT
    TABLE_CATALOG AS [Table Catalog],
    TABLE_SCHEMA AS [Table Schema],
    TABLE_NAME AS [Table Name],
    COLUMN_NAME AS [Column Name],
    IS_NULLABLE AS [Is Nullable],
    DATA_TYPE AS [Data Type]
FROM
    INFORMATION_SCHEMA.COLUMNS
ORDER BY
    TABLE_SCHEMA, TABLE_NAME
$"

Message("Query",qry)
;qry could be output as json or csv
;then used to support AI Integration

below is csv for what is supported
Database,Supports INFORMATION_SCHEMA.COLUMNS
MySQL,Yes
PostgreSQL,Yes
Microsoft SQL Server,Yes
MariaDB,Yes
Amazon Redshift,Yes
Snowflake,Yes
Apache Hive,Yes
H2 Database,Yes
CockroachDB,Yes
ClickHouse,Yes
Trino,Yes
MonetDB,Yes
HSQLDB,Yes
SingleStore,Yes
InterSystems Caché,Yes
Oracle Database,No
SQLite,No
IBM Db2,No
Microsoft Access,No
Firebird,No
Teradata,No
Sybase ASE,No
Apache Derby,No
Ingres,No
IBM Informix,No
SAP HANA,No
Apache Ignite,No