Git Product home page Git Product logo

firebolt-node-sdk's People

Contributors

aymeric-dispa avatar carlosmecha avatar dependabot[bot] avatar jeseeq avatar kevinmarr avatar ptiurin avatar qtax avatar rotemfb avatar spinscale avatar stepansergeevitch avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

firebolt-node-sdk's Issues

Iterating array using "for (... in ...)" in hydrateRow()

In hydrateRow() you are using for (... in ...) to iterate an array (meta). But that does not iterate the array indices, and instead iterates the object keys of the whole prototype chain (and causes an exception in case there is something there).

for (const index in meta) {

Could you please change that to an for (... of ...) with meta.entries() instead?

Example updated function (not tested):

export const hydrateRow = (
  row: Row,
  meta: Meta[],
  executeQueryOptions: ExecuteQueryOptions
) => {
  const isArray = Array.isArray(row);
  const hydratedRow = isArray ? [] : {};

  for (const [index, column] of meta.entries()) {
    if (isArray) {
      (hydratedRow as unknown[])[index] = getHydratedValue(
        row[index],
        column.type,
        executeQueryOptions
      );
    } else {
      const key = column.name;
      (hydratedRow as Record<string, unknown>)[key] = getHydratedValue(
        row[key],
        column.type,
        executeQueryOptions
      );
    }
  }
  return hydratedRow;
};

"Comments" removed from strings

Noticed that escapes are not handled properly when comments are being removed.

For example running

select 'my string\' here'

gives you my string' here as expected.

But running this query breaks:

select 'my string\' -- here'

Result:

Reason: Invalid input error: SQL query not valid.
SQL query:
==========
select 'my string\' 
                   ^=== ERROR HERE!
==========
Error line: 0
Error column: 19
Error message: syntax error, unexpected UNTERMINATED_STRING, expecting end of file

Response status: 500

Also that how strings are parsed by the server can be controlled by a setting standard_conforming_strings doesn't make this easier. But at least the default setting (that allows escapes like in the example above) should work.

Array parameters are formatted incorrectly

Referring to the line here, which converts array parameters to "[" instead of "(" as required for queries which include "in" clause.

I can supply example queries if required, but I believe this is pretty straightforward.

Thanks.

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.