depyronick / clickhouse-client

ClickHouse Client for NodeJS
https://clickhouse.js.org
MIT License
50 stars 11 forks source link

Add Parametrized Query capabilities. #20

Closed antoniovizuete closed 2 years ago

antoniovizuete commented 2 years ago

Hi!

I'm using the library. It's fantastic!! But I found a lack. I mean, I need to send parametrized queries to the Clickhouse server. The current status of the library doesn't have this capability.

So, I'd like to contribute to the library by adding Parametrized Query functionality.

Now, the two main methods (query and queryPromise) accept an optional second argument, a Record<string, string | number>. It represents the params as key-value pairs.

The client carries out the transformation of the params name to the Clickhouse convention. Thus, the usability of the library increases.

Additionally, I've added an e2e test to ensure the functionality.

Further information:

Many thanks for your incredible work and effort.

Kind regards,

Antonio

depyronick commented 2 years ago

Hello, @antoniovizuete

Thank you for this critical contribution. I'll merge this into dev first, then will do a few tests before releasing.

Can you please add brief examples and descriptions to the README file on this about how it works and can be used?

antoniovizuete commented 2 years ago

Hi @depyronick!

I've just updated the README file. I added the info about how the queries with params work and how can be used.

antoniovizuete commented 2 years ago

Hi @depyronick!

Is there any news about the PR?

Thanks in advance!

depyronick commented 2 years ago

It looks good with the latest changes. I’ll be able to review and merge this weekend. Sorry for the delay, been a long week. @antoniovizuete

antoniovizuete commented 2 years ago

Many thanks!