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

c result proxy raises NoSuchColumnError for getattr() access, inconsistent with pure python #2398

Closed
sqlalchemy-bot opened this issue Feb 5, 2012 · 5 comments
Labels
bug Something isn't working sql
Milestone

Comments

@sqlalchemy-bot
Copy link
Collaborator

Migrated issue, originally created by Michael Bayer (@zzzeek)


Attachments: 2398.patch

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

patch:

diff -r 0b97ba8a1410447797c0a1d049b2cfb6cc066ff3 lib/sqlalchemy/cextension/resultproxy.c
--- a/lib/sqlalchemy/cextension/resultproxy.c	Wed Mar 14 13:10:31 2012 -0700
+++ b/lib/sqlalchemy/cextension/resultproxy.c	Wed Mar 14 13:47:15 2012 -0700
@@ -353,7 +353,16 @@
     else
         return tmp;
 
-    return BaseRowProxy_subscript(self, name);
+    tmp = BaseRowProxy_subscript(self, name);
+    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
+        PyErr_Format(
+                PyExc_AttributeError, 
+                "Could not locate column in row for column '%s'",
+                PyString_AsString(name)
+            );
+        return NULL;
+    }
+    return tmp;
 }
 
 /***********************

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

full patch w changelog

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • attached file 2398.patch

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

7ad0c8c

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added bug Something isn't working sql labels Nov 27, 2018
@sqlalchemy-bot sqlalchemy-bot added this to the 0.7.6 milestone Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sql
Projects
None yet
Development

No branches or pull requests

1 participant