Re: [wasm] sqlite as rfc-spec'd web-interchange-format?

kai zhu <kaizhu256@gmail.com> Sat, 28 November 2020 22:01 UTC

Return-Path: <kaizhu256@gmail.com>
X-Original-To: ietf@ietfa.amsl.com
Delivered-To: ietf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 517FF3A03F3 for <ietf@ietfa.amsl.com>; Sat, 28 Nov 2020 14:01:45 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.847
X-Spam-Level:
X-Spam-Status: No, score=-1.847 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dY4UzApO6ed9 for <ietf@ietfa.amsl.com>; Sat, 28 Nov 2020 14:01:43 -0800 (PST)
Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DFF4A3A03F2 for <ietf@ietf.org>; Sat, 28 Nov 2020 14:01:42 -0800 (PST)
Received: by mail-vs1-xe2b.google.com with SMTP id w71so3261138vsw.9 for <ietf@ietf.org>; Sat, 28 Nov 2020 14:01:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GQUdYJmnnYeaPGj6stw/Ky31KjxgdnLjDjseqKJ0HrU=; b=kjoe4ic+eJiP10xfPZpbYiv2wQjehRxXe7l/9u87GnM7BoTei6vojX1WAYmFMAVF18 Mk0aEemFtOySXdBFzk0+raEaw1lAOgYt6krl8jvYGIycfY2+U8vOJZpYHcATKtc9Kwkj nirOjtSVLb0aFIjXjwLHWhyo9UzzoKCWFSdh4wvKYA5yQIXO0fRzdg44kWPp5Hzjfc31 xJCVotj/zRCNcTh4T+pYQ4g43Q/Kwt4wWYh+J3mXqVf4dMYxaZSem1Oe+CQOejwz32mj PnyJU6BDAY52c/asoNUQ1NbvIaKGP5+xJ29DnrcdH3rzmfPRyQ575ExYdMBOQ1hRv75n RBNA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GQUdYJmnnYeaPGj6stw/Ky31KjxgdnLjDjseqKJ0HrU=; b=Vx7ZHZDI9q0QcemOL9+2xuj0w3ggt8bDoZTX03Ywq92l4b4aLhLPZsZ00uRGO9te4p 9TzxsiSWb69TED8qtxzj9z91WM11gh5skcwXZH9XhfQUt5nMaNlZ/0Y4NL90WR8ITgp9 EBHkf9D3241CrYwl0tz65a3x+NZn4fXVC7kAGECqtIvqlzwo7GpM43LO+nuwZt9EWaob REMEv2WhEClD0Wu0Q25C1PhrtP/OZNvbNhSpdbUHt4rvtP1QkT+3SzQrMX35DxjItbKQ xVnbPmlxy225gO0u3ORrrTSfF7fzBFl/eGJ7VPF4PUTd27SF2gPjf8bZSNhkcL9k5zka rltQ==
X-Gm-Message-State: AOAM533W/e47xF9hUd2EbDy1X/1SVZZW5h2jVG/v8r3vuouVrgYMC5Dx R5Dy5Y6RVVIRRDoC6NvCHc6zoJ2RcQnjF7C15d0=
X-Google-Smtp-Source: ABdhPJzEtxrbMzRWPNVEX32UTyaAo6TXmL5YFlqJ62Bf14fmd+OrDZeS3xpHsFz3ckWhBEsZJhn3ILIvwXj5QGyXtu0=
X-Received: by 2002:a67:ec85:: with SMTP id h5mr9102491vsp.2.1606600901908; Sat, 28 Nov 2020 14:01:41 -0800 (PST)
MIME-Version: 1.0
References: <CALPJ4700ueNSZvBfRjsD82X6dkGxTO8RaJYXrs4uC2oH8MTa9A@mail.gmail.com> <4866.1606544057@localhost> <2CF416F26FCBA95606B9B442@PSB>
In-Reply-To: <2CF416F26FCBA95606B9B442@PSB>
From: kai zhu <kaizhu256@gmail.com>
Date: Sat, 28 Nov 2020 16:01:32 -0600
Message-ID: <CALPJ473c7sQ-iGyiyvciz_oi+SXruAnwEXOrme-SA-u4Sjo=vw@mail.gmail.com>
Subject: Re: [wasm] sqlite as rfc-spec'd web-interchange-format?
To: John C Klensin <john-ietf@jck.com>
Cc: Michael Richardson <mcr+ietf@sandelman.ca>, IETF Discussion Mailing List <ietf@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000000ddcca05b531ec43"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ietf/sdnknL4l23akj58yMoJGmiUMMAk>
X-BeenThere: ietf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IETF-Discussion <ietf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf>, <mailto:ietf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ietf/>
List-Post: <mailto:ietf@ietf.org>
List-Help: <mailto:ietf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf>, <mailto:ietf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 28 Nov 2020 22:01:45 -0000

> nothing SQL-compatible is going to do the job.

we all acknowledge sqlite is not perfect, but do you have something that
could do the job better?  like keith said, its possible sqlite file-format
is the best choice that currently exists (for exchanging
relational-datasets over web).

> bincode, msgpack, protobuf, and of course, IETF's CBOR RFC7049.  Also
JSON.

i've had experience with protobuf, json, (plus json-schema and graphql).
as far as serializer/reviver ergonomics:
1.
json is idiot-proof for non-relational data.  json-schema is soso for
relational-data.
2.
protobuf and graphql are likely idiot-proof *if* you work at
google/facebook (and access to internal-tooling).  but my [frontend]
experience with their opensource serializers/revivers are disappointing and
error-prone.
3.
wasm-sqlite's serializers/revivers are idiot-proof for relational-data:
```javascript
// webassembly serializer:
FS.readFile("/sqlite-database.db") // return <serialized Uint8Array>

// webassembly reviver:
var dbRevived;
var ptr = stackAlloc(4);
FS.createDataFile("/", "sqlite-database.db", <serialized Uint8Array>, true,
true);
sqlite3_open("sqlite-database.db", ptr);
dbRevived = getValue(ptr, "i32"); // revived sqlite-database (in virtual fs)
...
sqlite3_exec(dbRevived, "SELECT * FROM my_table;", <callback>, 0, ptr);
...
```




On Sat, Nov 28, 2020 at 4:34 AM John C Klensin <john-ietf@jck.com> wrote:

>
>
> --On Saturday, November 28, 2020 01:14 -0500 Michael Richardson
> <mcr+ietf@sandelman.ca> wrote:
>
> >
> > It's an interesting idea.
> >
> > There are quite a number of other serialization formats out
> > there including: bincode, msgpack, protobuf, and of course,
> > IETF's CBOR RFC7049.  Also JSON. For "opendata" we've would up
> > with CSV, which I really dislike. {So funny that the UK's data
> > problem with COVID rates was due to some data flow that went
> > CSV->XLS->database, fixed when they went CSV->XLSX->database,
> > when there was never a reason to use XLS* at all. So perhaps
> > this argues your case}
> >
> > The question you likely need to answer are:
> >
> > 1) do the sqlite people wish to turn change control over to
> > the IETF?
> >
> > 2) Given the Library of Congress statement, is there actually
> > a net benefit    to the world?  Maybe it's already moving to
> > defacto standard anyway.    Would the IETF process help?
> > Given the stability, would there be    any benefit for IANA?
> >
> > 2B) There may be NAFTA Article 10 ("Performance
> > Specification") reasons     for having an RFP'able
> > specification.
> >
> > 3) Are there enough implementers who are not sqlite.org who
> > would benefit?    Is the wasm-sqlite from sqlite.org (I don't
> > know).
> >
> > I looked through the specification, and turning it into an RFC
> > wouldn't be hard.  You may wish to look at the work in the
> > CELLAR WG, which is doing something similar for archival
> > formats for AV.
>
> I have not studied or used sqlite, but, stepping back from the
> details...
>
> Let me add something from a very different perspective -- maybe
> useful, maybe not.  If you are looking for a data serialization
> and interchange standpoint _and_ expect it to be able to
> accommodate the full range of statistical and scientific
> databases rather than only nicely rectangular, row-oriented,
> commercial databases and things that behave like them, nothing
> SQL-compatible is going to do the job.
>
> To save typing in a longer list, several of the papers in
> Rafanelli, M., Klensin, J.C., and Svensson, P., eds.,
> _Statistical and Scientific Database Management: Fourth
> International Working Conference on Statistical and Scientific
> Database Management, Rome, Italy, June 1988,  Proceedings_,
> Springer-Verlag Lecture Notes in Computer Science #339, 1989.
> (And, yes, for those who don't know, I had a life or three
> before getting sucked back, almost fully, into Internet work.)
>
>     best,
>       john
>
>
>
On Sat, Nov 28, 2020 at 4:34 AM John C Klensin <john-ietf@jck.com> wrote:

>
>
> --On Saturday, November 28, 2020 01:14 -0500 Michael Richardson
> <mcr+ietf@sandelman.ca> wrote:
>
> >
> > It's an interesting idea.
> >
> > There are quite a number of other serialization formats out
> > there including: bincode, msgpack, protobuf, and of course,
> > IETF's CBOR RFC7049.  Also JSON. For "opendata" we've would up
> > with CSV, which I really dislike. {So funny that the UK's data
> > problem with COVID rates was due to some data flow that went
> > CSV->XLS->database, fixed when they went CSV->XLSX->database,
> > when there was never a reason to use XLS* at all. So perhaps
> > this argues your case}
> >
> > The question you likely need to answer are:
> >
> > 1) do the sqlite people wish to turn change control over to
> > the IETF?
> >
> > 2) Given the Library of Congress statement, is there actually
> > a net benefit    to the world?  Maybe it's already moving to
> > defacto standard anyway.    Would the IETF process help?
> > Given the stability, would there be    any benefit for IANA?
> >
> > 2B) There may be NAFTA Article 10 ("Performance
> > Specification") reasons     for having an RFP'able
> > specification.
> >
> > 3) Are there enough implementers who are not sqlite.org who
> > would benefit?    Is the wasm-sqlite from sqlite.org (I don't
> > know).
> >
> > I looked through the specification, and turning it into an RFC
> > wouldn't be hard.  You may wish to look at the work in the
> > CELLAR WG, which is doing something similar for archival
> > formats for AV.
>
> I have not studied or used sqlite, but, stepping back from the
> details...
>
> Let me add something from a very different perspective -- maybe
> useful, maybe not.  If you are looking for a data serialization
> and interchange standpoint _and_ expect it to be able to
> accommodate the full range of statistical and scientific
> databases rather than only nicely rectangular, row-oriented,
> commercial databases and things that behave like them, nothing
> SQL-compatible is going to do the job.
>
> To save typing in a longer list, several of the papers in
> Rafanelli, M., Klensin, J.C., and Svensson, P., eds.,
> _Statistical and Scientific Database Management: Fourth
> International Working Conference on Statistical and Scientific
> Database Management, Rome, Italy, June 1988,  Proceedings_,
> Springer-Verlag Lecture Notes in Computer Science #339, 1989.
> (And, yes, for those who don't know, I had a life or three
> before getting sucked back, almost fully, into Internet work.)
>
>     best,
>       john
>
>
>