Comments (8)
Agree with @dossy, we cannot register something generic like http://
to Clickhouse. clickhouse+http://
is a good solution and is clear.
If we want to support interop with existing clickhouse connection strings, then we could potentially offer a new optional CLI flag to override the driver. For example something like:
dbmate --url "http://default:changeme@localhost:8123/default" --driver clickhouse up
Thus the clickhouse driver could support both clickhouse+http://
and http://
, but only clickhouse+http://
would automatically load the correct driver. I haven't thought through all the implications of this, but I think it might work.
from dbmate.
Thanks for the elaborated response, I agree with the reasonings + I think that supplying the default based on scheme is a great idea.
8123 and 8443 are indeed the acceptable ports for http and https by clickhouse as can be read from the docs: https://clickhouse.com/docs/en/guides/sre/network-ports
I think I will try to tackle this one
from dbmate.
I would be in favor of supporting this "experimental" HTTP transport, based on the ClickHouse README change on Jul 8, 2022 and still marked experimental today, as long as the database URL driver is prefixed, for example, clickhouse+http://
.
from dbmate.
Related discussion: #474.
from dbmate.
Well, even if we do add the support for http client for clickhouse, this won't change the fact you will need to use a different DATABASE_URL for dbmate, as we still need a db-specific prefix to map to the correct driver.
@dossy In my opinion, we can just the update the scheme to be "http" instead of "clickhouse" in case the user provided a port of "8123" (http) or 8443 (https).
Instead of using a new specific driver prefix.
What do you think?
from dbmate.
@dossy In my opinion, we can just the update the scheme to be "http" instead of "clickhouse" in case the user provided a port of "8123" (http) or 8443 (https). Instead of using a new specific driver prefix.
What do you think?
I'm not a fan of the idea of using the port number to infer the transport layer: it could lead to unintended surprises when a user, not aware of this "magical" association, uses a port that suddenly changes the transport layer.
We often use the same port numbers for particular services out of tradition, because most services are not officially registered with IANA. But, ultimately, port numbers are arbitrary: there is nothing technically stopping you from running your database bound to port 1/tcp, aside from some antiquated "binding to privileged ports" restriction which is simply a matter of configuration, or using a port redirection like NAT.
Requiring a user to specify the transport in the URL, e.g., clickhouse://
vs. clickhouse+http://
or clickhouse+https://
, is explicit and clear. There is no question as to what database driver, and what transport layer protocol will be used, when looking at the URL.
Now, I think the idea of defaulting the port, if not specified in the URL, depending on the URL scheme, may make sense if there is an expectation that a particular port will be used by default. In other words, specifying clickhouse+http://
as the scheme could default to port 8123
if a port is not specified explicitly in the URL, and clickhouse+https://
default to port 8443
if not explicitly specified in the URL. If those are the two most commonly used and expected ports by ClickHouse users who use the HTTP/HTTPS transports, then I think it makes sense to use those as defaults.
from dbmate.
If we want to support interop with existing clickhouse connection strings, then we could potentially offer a new optional CLI flag to override the driver.
I'm in favor of this approach, because ClickHouse users can use the same DATABASE_URL
string with code that directly uses the clickhouse-go client or dbmate. Does it make sense to use DBMATE_DRIVER
as an environment variable for specifying the driver, too?
from dbmate.
Yeah DBMATE_DRIVER
env var makes sense too - matches the other supported env vars
from dbmate.
Related Issues (20)
- Dbmate Unable to Create SchemaMigrations Table HOT 6
- Postgres Schemas with special characters have DBMate create migration tables then cannot find it again
- ClickHouse Cloud https connection doesn't work HOT 2
- Getting pq: syntax error at or near "transaction" when running migration with transaction:false HOT 7
- The migration lock is not released after terminating the migration HOT 2
- Comments (on columns) that include line breaks are never created. HOT 1
- dbmate requires each migration to define a down block with '-- migrate:down' when it defined HOT 5
- No Zookeeper configuration in server config
- Wait for Postgres to be ready HOT 3
- $PGHOST & $PGPORT are not respected. HOT 2
- Add a section to the README documenting how environment variables are used by dbmate
- Table aliases don't work with ClickHouse HOT 2
- Add `--wait-interval` and `$DBMATE_WAIT_INTERVAL` to make wait interval configurable at runtime HOT 7
- The latest release is missing all the binaries HOT 2
- Could not open extension control file "/share/extension/http.control" HOT 2
- Embedded FS on Windows HOT 2
- `make docker-all` timeout when run locally. HOT 1
- DBMate always delets my database anytime I run a migration HOT 1
- Library methods not using context
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbmate.