Git Product home page Git Product logo

Comments (8)

findepi avatar findepi commented on September 16, 2024 2

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.

nineinchnick avatar nineinchnick commented on September 16, 2024 1

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.

Chaho12 avatar Chaho12 commented on September 16, 2024

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.

Chaho12 avatar Chaho12 commented on September 16, 2024

@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.

findepi avatar findepi commented on September 16, 2024

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.

Chaho12 avatar Chaho12 commented on September 16, 2024

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.

losipiuk avatar losipiuk commented on September 16, 2024

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.

Chaho12 avatar Chaho12 commented on September 16, 2024

@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.

from trino-go-client.

Related Issues (20)

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.