INNOV-AI

Innovation and Research from Réunion Island, France

Back   Home

Make a data quality algorithme on a SQL table output @ Output page @ MentDB Weak

> Start the server
> (or start the server for the first time (embedded mode - H2 Database))
> (or start the server for the first time (remote mode - MySQL 8 Database))
> Open the MentDB Weak Editor

MQL INPUT
#This source code create a table and load data for the demonstration;

#Connect to the database;
sql connect "session1" {cm get "MENTDB";};

#Create the table;
sql dml "session1" (concat "DROP TABLE IF EXISTS coord;
CREATE TABLE coord (
	id bigint NOT NULL AUTO_INCREMENT,
	name varchar(255) NOT NULL ,
	x int NOT NULL,
	x1 int NOT NULL,
	x2 int NOT NULL,
	y int NOT NULL
);");

#insert random data into the table;
for (-> "[i]" 65) (<= [i] 90) (++ "[i]") {

		if (math random 2) {
			-> "[result]" (sql dml "session1" (concat 
				"INSERT INTO public.coord (
					name,
					x,
					x1,
					x2,
					y
				) VALUES (
					" (sql encode (string int_to_char [i])) " ,
					" (sql encode [i]) " ,
					" (sql encode (- [i] 10)) " ,
					" (sql encode (- [i] 20)) " ,
					" (sql encode (+ 1 [i])) "
				);"
			));
		} {
			-> "[result]" (sql dml "session1" (concat 
				"INSERT INTO public.coord (
					name,
					x,
					x1,
					x2,
					y
				) VALUES (
					" (sql encode (string int_to_char [i])) " ,
					" (sql encode [i]) " ,
					" (sql encode (- [i] 10)) " ,
					" (sql encode (- [i] 20)) " ,
					" (sql encode (- [i] 1)) "
				);"
			));
		};
		
};

#Disconnect from the database;
sql disconnect "session1";
MQL INPUT
"1"

In the CONNECT menu double click on MENTDB database...

You can see the 'coord' table...

Or if your database is already opened, right click on MENTDB database and select 'Show table' to refresh, or click on the refresh button...

Your table 'coord' appears ...

Right click on a colomn to set the DQ/x

Select algorithms (CTRL or APPLE pour multiple selection), and click on OK

MQL INPUT
# This code is generated ;

json load "dq" "[]";

json load "dq_x1" "{}";
json iobject "dq_x1" / field "x1" STR;
json iobject "dq_x1" / algo "{}" OBJ;
json iobject "dq_x1" /algo "is_big_int" (mql {
	type is_big_int [T_x1];
}) STR;
json iobject "dq_x1" /algo "is_empty" (mql {
	is empty [T_x1];
}) STR;
json iobject "dq_x1" /algo "is_hour" (mql {
	type is_hour [T_x1];
}) STR;
json iarray "dq" / (json doc "dq_x1") OBJ;

dq analyse "MENTDB" (json doc "dq") "coord" "SELECT * FROM public.coord LIMIT 0, 500";
MQL INPUT
# You can extand your list of algorithm with the MQL command starts with dq_ ;

dq algorithm set "your_key" (mql {
	
	#Your algorithm here in MQL;
	#The last command must return a boolean;
	true;
	
});
start: 2025-12-19   end: 2026-01-09   v_start: 401   v_end: