In PostgreSQL, this code:
{{{
# select a row from website_type_tbl(wtype_id INTEGER PK, show_ads
BOOLEAN)
row = website_type_tbl.select().execute().fetchone()
# insert another row
website_type_tbl.insert().execute(wtype_id=5, show_ads=row.show_ads)
}}}
Produces error - SQLError:
It must be something stupid on my end, then. I'm sure I'll smack
myself when I figure it out.
Thanks for your help.
On Dec 20, 6:24 pm, Michael Bayer [EMAIL PROTECTED] wrote:
i just tried out your example and it executes fine using mysql 5, query
output is:
SELECT blog_articles.timestamp AS
Remember this is not a wiki! {{{}}} won't format the code as you might
expect.
BTW, everything ok here on pgsql; boolean are True or False. You should try
posting at least your db metadata and tell us which version of pgsql and
psycopg you're using.
--
Alan Franzoni [EMAIL PROTECTED]
-
Togli
Michael Bayer ha scritto:
the original mapping essentially expressed this relationship:
A -- cascade=all, delete-orphan -- B
in both directions. What that means is, there cannot be an A with no B
in the database, and there cannot be a B with no A in the database,
i.e. its either A-B or
Alan Franzoni ha scritto:
The problem is that it requires the explicit use of the session.
In my case this means that I can not delete the object inside a method
of my class.
class A(object):
def enableB(enable=True):
if enable:
self.b = B(...)
A better solution is to do
sess = object_session(self)
That's wonderful and I didn't know about it!
Finally I'll give up passing session around my code!
Thanks!
--
Alan Franzoni [EMAIL PROTECTED]
-
Togli .xyz dalla mia email per contattarmi.
Remove .xyz from my address in order to contact
I'm just learning to use SQLAlchemy and loving the way it can figure
out the columns for a simple table. Now, if I need relations, do I need
to specify all tables? (Or can I get away with only specifying he
relation?)
Thanks,
A.
--~--~-~--~~~---~--~~
You
thats true the PG boolean type is not currently performing any
translation on the value, meaning the 0 and 1 is what psycopg2 is
giving you. however, the value should be able to go right back in if
thats what its giving you, else psycopg2 is not consistent with itself.
anyway as a workaround
if you reflect a table that has a foreign key reference on itself to
another table, that other table will be reflected as well, but at that
point the second Table object is sitting inside the MetaData instance.
to use it in a relation still requires that the related class is
mapped, which
thats true the PG boolean type is not currently performing any
translation on the value, meaning the 0 and 1 is what psycopg2 is
giving you. however, the value should be able to go right back in if
thats what its giving you, else psycopg2 is not consistent with itself.
? which version of
in sanjay's example, its inserting an integer 1 or 0 value, not True.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To
func.current_timestamp() (which evaulates without the parenthesis in
SQL)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To
12 matches
Mail list logo