In article [EMAIL PROTECTED],
Alex Martelli [EMAIL PROTECTED] wrote:
Aahz [EMAIL PROTECTED] wrote:
Alex:
But don't put such black magic in production. The completely different
way is: just don't.
Could you expand on that? After all, that's exactly what we do to
implement a super() that
Martin Drautzburg wrote:
def SQL(sql, checked=set()):
if sql in checked:
return True
if not valid_sql(sql): raise ValueError
checked.add(sql)
return sql
No this does not do the trick. I will not be able to validate an sql
statement bofore I run over the
George Sakkis wrote:
Yes, there is: use an ORM to do the SQL generation for you. Check out
SQLAlchemy, it will buy you much more than what you asked for.
Might look, though in general I don't like OR mappers much. Having SQL
generated feels as strange as having python code generated. Too much
Peter Otten wrote:
def SQL(sql):
... print sql
...
a = SQL(module)
module # that one was obvious
class A:
... b = SQL(class)
... def method(self, c=SQL(default arg)):
... d = SQL(method)
...
You are my hero. Indeed very cool!
--
In article [EMAIL PROTECTED],
Alex Martelli [EMAIL PROTECTED] wrote:
Martin Drautzburg [EMAIL PROTECTED] wrote:
The problem is the first part: how can I lookup the callers module and
the classobjs defined in there? Or finding any constant strings in the
caller's module would also be just fine.
Aahz [EMAIL PROTECTED] wrote:
But don't put such black magic in production. The completely different
way is: just don't.
Could you expand on that? After all, that's exactly what we do to
implement a super() that works with classic classes -- and it's certainly
production code.
Martin Drautzburg [EMAIL PROTECTED] wrote:
George Sakkis wrote:
Yes, there is: use an ORM to do the SQL generation for you. Check out
SQLAlchemy, it will buy you much more than what you asked for.
Might look, though in general I don't like OR mappers much. Having SQL
generated feels as
I would like to validate sql strings, which are spread all over the
code, i.e. I run (prepare) them against a database to see if it happy
with the statements. Spelling errors in sql have been a major pain for
me.
The statements will not be assembled from smaller pieces, but they will
not
Martin Drautzburg wrote:
I would like to validate sql strings, which are spread all over the
code, i.e. I run (prepare) them against a database to see if it happy
with the statements. Spelling errors in sql have been a major pain for
me.
The statements will not be assembled from smaller
Peter Otten wrote:
Martin Drautzburg wrote:
I would like to validate sql strings, which are spread all over the
code, i.e. I run (prepare) them against a database to see if it
happy with the statements. Spelling errors in sql have been a major
pain for me.
def
Martin Drautzburg wrote:
I would like to validate sql strings, which are spread all over the
code, The statements will not be assembled from smaller pieces,
but they will not neccessarily be defined at module level. I could
live with class level,
parse the source file, but I am
On Apr 21, 4:16 pm, Martin Drautzburg [EMAIL PROTECTED]
wrote:
I would like to validate sql strings, which are spread all over the
code, i.e. I run (prepare) them against a database to see if it happy
with the statements. Spelling errors in sql have been a major pain for
me.
The statements
Martin Drautzburg [EMAIL PROTECTED] wrote:
...
The problem is the first part: how can I lookup the callers module and
the classobjs defined in there? Or finding any constant strings in the
caller's module would also be just fine. Or is there a completely
different way to do such a thing?
13 matches
Mail list logo