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

OneAgent SDK causing breaking changes with DB cursors #76

Open
alon-selfinc opened this issue May 18, 2023 · 5 comments
Open

OneAgent SDK causing breaking changes with DB cursors #76

alon-selfinc opened this issue May 18, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@alon-selfinc
Copy link

Hi! We are trying to incorporate the OneAgent SDK into our codebase.
Currently on oneagent-sdk~=1.5.0.20221221.150433, psycopg2==2.9.5 running on Python 3.7.2.

Our create_app() flask function essentially runs this:

import oneagent

init_result = oneagent.initialize()
sdk = oneagent.get_sdk()

After incorporating the SDK, all of our DAO objects/queries are behaving differently.
We can no longer pull a field value by name out of a DB cursor:

odfi_uuid = None if dfi is None else dfi['uuid']
E       TypeError: tuple indices must be integers or slices, not str

We'd really appreciate any suggestions on tackling the issue. Please let me know if I can further clarify anything here. Thanks!

@alon-selfinc alon-selfinc added the bug Something isn't working label May 18, 2023
@dlopes7
Copy link
Collaborator

dlopes7 commented Jun 22, 2023

I am having a hard time reproducing, would you mind sharing a piece of code that allows you to access the rows like that?

When I run

cur = conn.cursor()
cur.execute("SELECT tablename, tableowner FROM pg_catalog.pg_tables")
for row in cur:
    print(row['tablename'])

I get the same error as you, even without autodynatrace installed

@dlopes7
Copy link
Collaborator

dlopes7 commented Jun 22, 2023

Are you per chance using

cursor_factory=RealDictCursor # or DictCursor

In the connection creation? I think I was able to reproduce by using that, and will look to implement a fix

@alon-selfinc
Copy link
Author

@dlopes7 you are correct! we are using DictCursor. sorry I should have clarified in my initial post. thanks so much for investigating!

@caseycoding
Copy link

caseycoding commented Jul 10, 2023

Hi @dlopes7! There might be a minor misspelling in this update: extras vs extra. Is it ok if we make MRs for you to review going forward? Don't want to toss it all your way. Thanks!

@davetonkin-LC
Copy link

@dlopes7 - Hi - just checking to see if you saw Casey's last comment. Are you able to reopen this and/or create a new issue to address the misspelling that he mentioned?

@dlopes7 dlopes7 reopened this Aug 23, 2023
@dlopes7 dlopes7 self-assigned this Aug 23, 2023
dlopes7 added a commit that referenced this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants