-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove platform-specific dependencies #162
Comments
Been running into the same issue right now, using ClickHouse for Analytics with Vercel/Next.js edge functions. |
This is similar to #153 and somewhat related to #150 Currently, we are considering several scenarios to move forward with the client, preferably with as little breaking change as possible, for example:
^ All of the above covers usage of the Personally, I am more in favor of the second option with a customizable Connection. Please let me know what you think. |
@slvrtrn, thanks for replying so quickly! The second solution you described is a good middle ground. I like it because it opens up the original library and allows for customization of its network behavior. However, since you will have to update the code in that specific place (meaning you'll have to rewrite how that layer of the library currently works), why not update it to use Correct me if I'm wrong, but the references you linked are related to In your opinion, would that be a good solution? By doing so, you would be using the |
@maxprilutskiy, fetch is experimental in Node.js, as well as WebStreams support. Additionally, fetch is 18.x+ only, while we still want to support 16.x as it is not EOL yet. I did some experiments lately with customizable connections; however, after a brief internal discussion, we are leaning towards just releasing two libraries - |
@slvrtrn awesome news!! Any approximate estimates of when this will become available? Also a side note that it's not only about |
@maxprilutskiy, yes, |
Sounds great! |
Try to see how this package uses fetch |
The first web release is out: https://www.npmjs.com/package/@clickhouse/client-web. I checked: it also works fine with Cloudflare workers, as it seems. wrangler init my-worker -y package.json: {
"name": "my-worker",
"version": "0.0.0",
"private": true,
"scripts": {
"deploy": "wrangler deploy",
"start": "wrangler dev"
},
"devDependencies": {
"@clickhouse/client-web": "0.2.0",
"@cloudflare/workers-types": "^4.20230419.0",
"typescript": "^5.0.4",
"wrangler": "^3.0.0"
}
} worker.ts: export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
const client = createClient();
const res = await client.query({
query: 'SELECT * FROM system.numbers LIMIT 5',
});
return new Response(await res.text());
},
}; prints: {
"meta":
[
{
"name": "number",
"type": "UInt64"
}
],
"data":
[
{
"number": "0"
},
{
"number": "1"
},
{
"number": "2"
},
{
"number": "3"
},
{
"number": "4"
}
],
"rows": 5,
"rows_before_limit_at_least": 5,
"statistics":
{
"elapsed": 0.000438058,
"rows_read": 5,
"bytes_read": 40
}
} @maxprilutskiy @andrezimpel |
I am closing this as we have |
Issue Description:
I would like to raise a concern regarding the current state of the
@clickhouse/client
package.It heavily relies on platform-specific dependencies, including
http
,zlib
, andstream
, which limits its usability in certain environments, particularly serverless edge setups. I believe it is crucial to address this issue and propose a solution that would make@clickhouse/client
more versatile and compatible with a broader range of platforms.Problem Statement:
The presence of node-specific dependencies in
@clickhouse/client
prevents its usage in environments where these dependencies are either unavailable or incompatible. For instance, serverless edge environments require platform-agnostic libraries to ensure seamless execution across different platforms. Unfortunately, the current state of@clickhouse/client
hinders its potential in such scenarios.Desired Outcome:
I kindly request the development team to reconsider the dependencies in
@clickhouse/client
and strive for a solution that eliminates any platform-specific ties. By doing so, we can make the client package more adaptable, enabling it to be used in a wider array of environments, including serverless edge deployments. This change would empower developers to leverage the benefits of the ClickHouse client in scenarios where these platform-specific dependencies are not available or compatible.Proposed Solution:
To address this issue effectively, I propose refactoring
@clickhouse/client
to remove direct dependencies on node-specific packages likehttp
,zlib
, andstream
. Instead, I recommend employing platform-agnostic alternatives or providing a pluggable interface that allows users to supply their own implementations for the underlying communication layer. Or,fetch
API could just be used instead, that is supported everywhere nowadays.Benefits:
@clickhouse/client
, making it viable for a wider range of platforms and environments.Additional Context:
Serverless edge computing has gained significant popularity due to its scalability and reduced infrastructure management overhead. By enabling the usage of
@clickhouse/client
in these environments, we can provide developers with a powerful tool for processing and analyzing data close to the edge, ultimately improving performance and reducing latency.I sincerely appreciate your consideration of this proposal. I look forward to engaging in a fruitful discussion regarding the possibilities of making
@clickhouse/client
more platform-agnostic. Thank you for your attention to this matter, and I kindly request your support in addressing this limitation.The text was updated successfully, but these errors were encountered: