Git Product home page Git Product logo

Comments (3)

jheer avatar jheer commented on May 22, 2024 1

Thanks! I tested this and the problem is that the return value of the query is already parsed. Instead of calling JSON.parse, simply use the returned q array.

If using a DuckDB server (socket connector), the result will be sent back as a JSON string and parsed internally. Meanwhile, DuckDB-WASM (wasm connector) only produces Arrow tables, so when json is requested the Arrow table is coerced to a JS-Array-of-Objects compatible array.

from mosaic.

jheer avatar jheer commented on May 22, 2024

Thanks for reporting the issue. Can you share a basic table CREATE and/or INSERT query with data that replicates the issue? (A single row table should be fine!) Then we can test directly on our end and see where in the pipeline the bug may arise.

from mosaic.

fundef1 avatar fundef1 commented on May 22, 2024

here you go:

vg.coordinator().exec('CREATE TABLE test AS SELECT \'^(?P<DD>0[1-9]|[1-2]\\d|3[0-1])/\' as teststring' );
vg.coordinator().query("SELECT teststring from test;", {type: "json", cache: false})
    .then((q) => {
            console.log(q.toString());
	    const t = JSON.parse(q);
            console.log(t);
	});

results in:

{"teststring": "^(?P<DD>0[1-9]|[1-2]\d|3[0-1])/"}
VM262:1 Uncaught (in promise) SyntaxError: Bad escaped character in JSON at position 37
    at JSON.parse (<anonymous>)
    at index.html:57:19
```

from mosaic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.