Skip to content
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

Does this library work with sqlx? #7

Open
pavelnikolov opened this issue Dec 9, 2017 · 2 comments
Open

Does this library work with sqlx? #7

pavelnikolov opened this issue Dec 9, 2017 · 2 comments

Comments

@pavelnikolov
Copy link

pavelnikolov commented Dec 9, 2017

I tried using this library with sqlx, but I cannot get it working.
Any ideas how to solve this problem? My goal is to make instrumentedsql work with named queries.

My code
bebfore:

db, err := sqlx.Open("postgres", config.DB.URL)

after:

	sql.Register("instrumented-postgres", instrumentedsql.WrapDriver(&pq.Driver{}, instrumentedsql.WithTracer(opentracingsql.NewTracer())))
	db, err := sql.Open("instrumented-postgres", config.DB.URL)

Tracing works just fine, but now I get "pq: syntax error at end of input" errors.

@pavelnikolov pavelnikolov changed the title Does this library work with *sqlx*? Does this library work with sqlx? Dec 9, 2017
@pavelnikolov
Copy link
Author

I managed to get sqlx working with the pq driver and instrumentedsql using the following code:

	sql.Register("instrumented-postgres", instrumentedsql.WrapDriver(&pq.Driver{}, instrumentedsql.WithTracer(opentracingsql.NewTracer())))
	db, err := sql.Open("instrumented-postgres", config.DB.URL)
        ...
        dbx := sqlx.NewDb(db, "postgres")

slagiewka pushed a commit to slagiewka/instrumentedsql that referenced this issue Sep 11, 2019
… when adding a tag for "error".

Signed-off-by: Amir Aslaminejad <aslaminejad@gmail.com>
slagiewka pushed a commit to slagiewka/instrumentedsql that referenced this issue Sep 11, 2019
@A-Kamaee
Copy link

Thanks @pavelnikolov! you saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants