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

TypeError: can't set attributes of built-in/extension type 'asyncpg.Record' #452

Open
crazyhouse33 opened this issue Jun 6, 2019 · 2 comments

Comments

@crazyhouse33
Copy link

Hi, I am trying to monkey patch the Record class (the getter) to get an history of every column that got accessed in the record (to only query what the user really need for the next n queries). However I cant do that, I got the error of the title.

I am pretty sure this is related to #451 and the strange nature of Record object.

I would like to know why Records are made like that and if you will change that. Right now I think I will re implement my driver class with another library if you dont have any workaround

@1st1
Copy link
Member

1st1 commented Jun 6, 2019

The records are made to mimic Python tuple design to achieve the best performance possible. I don't think we can allow monkey patching it, but we should allow users to provide their own factory for custom records. That will solve your use case, although i have no eta.

@1st1
Copy link
Member

1st1 commented Jun 6, 2019

You can of course work on a PR for that.

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