Comments (8)
I had one use case recently to set
X-Trino-Added-Prepare
but I managed to add support for prepared statements in #44 so it's not an issue anymore.
Awesome use-case!
But also example why we don't shouldn't tend to expose raw headers. This encourages people to hack around their use-cases, which is awesome for super advanced users, but also discourages people from actually improving the code.
from trino-go-client.
I think the JDBC is the reference implementation. Python is not a good comparison, since you can't hide anything in Python anyway.
I don't mind keeping this issue open so that we could wait for others to report actual use cases where they need to pass headers. I had one use case recently to set X-Trino-Added-Prepare
but I managed to add support for prepared statements in #44 so it's not an issue anymore.
from trino-go-client.
after reviewing golang url code, i take back second suggestion as URL schema has UserInfo.
It suggests general form as [scheme:][//[userinfo@]host][/]path[?query][#fragment]
, so separating default user
with server addr
would be unnecessary and would only make code dirtier
from trino-go-client.
@losipiuk
Hey, am back to work with Presto :)
While I was working with query callback, I was wondering WDUT about this idea of changing header constants to public?
prestoUserHeader
-> UserHeader
(if it is changed, the word Presto
name starts with package name, which is unnecessary in Goalng ref)
Other headers that needs to be fixed are as following:
prestoSourceHeader = "X-Presto-Source"
prestoCatalogHeader = "X-Presto-Catalog"
prestoSchemaHeader = "X-Presto-Schema"
prestoSessionHeader = "X-Presto-Session"
from trino-go-client.
Ideally all the headers-related logic should be handled within the client library.
Exposing headers may be view as an escape valve, but I would want to make sure
this doesn't discourage us from providing proper APIs for everything that's needed.
How can we achieve that?
from trino-go-client.
Am not that experienced engineer so it may say seem to be silly questions, btw is defining constants considered part of headers-related logic
? As user of the API, I would sometimes want to change user name, but then I would have to type or make a const for X-Presto-User
which seems silly cause it is already used within presto go client.
rows, err := db.Query("SELECT current_user", sql.Named(PrestoUserHeader, string("TestUser")))
from trino-go-client.
I think this is fine to pass extra configuration parameters via sql.Named(CONFIG_KEY, CONFIG_VALUE)
.
But I think that the set of valid values for the CONFIG_KEY
values should be defined explicitly and not necessarily map 1:1 to internal set of http headers used by Presto communication protocol.
from trino-go-client.
@losipiuk @nineinchnick Hi, I tagged you guys because I wanted to ask final question before closing this issue, opening headers as public constants like other client does, for convenience sake.
- python : https://github.com/trinodb/trino-python-client/blob/master/trino/constants.py
- node : https://github.com/tagomoris/presto-client-node/blob/master/lib/presto-client/headers.js
from trino-go-client.
Related Issues (20)
- Queries don't get canceled on context cancel HOT 8
- Does trino-go-client support golang sql.NamedArg? HOT 2
- Do not send DELETE after QueryRow HOT 1
- Can't execute more than one query on one connection HOT 9
- ParsingException for SQL Server when stored-procedure-table-function is enabled HOT 3
- Client.Timeout exceeded while awaiting headers
- access kerberized data HOT 10
- Queries sometimes fail when decoding progress percent in the response HOT 2
- How to set a custom name to prepared statements, in different connections HOT 2
- Add option to configure X-Trino-Client-Tags http header based on a setting in the conenction URL
- I use QueryContext to query a super long sql (13700 bytes). When there are args parameters, the error http2ErrCodeEnhanceYourCalm (11) will be reported. Has anyone encountered this? HOT 3
- Is there a way to exec a query without handling it as a prepared statement? HOT 3
- Update Go version to 1.18 HOT 3
- Can't update to v0.310.0 HOT 3
- Reduce dependencies HOT 12
- Pool of system root CAs is not used by default in case of https connection with no `SSLCert` and `SSLCertPath` configured.
- Null support for inserts HOT 3
- Bug/Feat: Performance degradation with multiple requests HOT 8
- Panic in `CheckNamedValue()` for an `INSERT` prepared statement which receives a nil value HOT 1
- Expose underlying trino error codes / names HOT 2
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 trino-go-client.