SQL dump from AlaSQL

mathiasrw asked for this feature almost 4 years ago — 2 comments

mathiasrw commented almost 4 years ago Admin

Would be good to export data from AlaSQL to a pure SQL string. Could be done by a INTO SQL() approach.

    var data = [{id:1}];
    var sql = alasql('SELECT * INTO SQL({tableid:'one'}) FROM ?',[data]);
    // sql = 'INSERT INTO one (id) VALUES (1);');

where the config argument to SQL() could have a flag to include table structure.

A more SQL'ish solution would be

a) to have dump command for specific database, like:

    var sql = alasql('DUMP DATABASE mybase');

b) dump all databases in current alasql object:

    var sql = alasql('DUMP');

| nbdamian commented about 3 years ago

If we have a dump function, we should include an import function as well, so that if you dump, you can then import that dump if need be.

Join the discussion!

with GitHub to comment