-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Eloff
Sent: 08 September 2009 21:34
To: sqlalchemy
Subject: [sqlalchemy] Re: How to bypass scoped_session?
On Sep 8, 3:47 am, King Simon-NFHD78 simon.k...@motorola.com
wrote
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Eloff
Sent: 08 September 2009 04:40
To: sqlalchemy
Subject: [sqlalchemy] How to bypass scoped_session?
Hi,
I'm using scoped_session in my pylons app, but sometimes I have
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of gizli
Sent: 02 September 2009 04:45
To: sqlalchemy
Subject: [sqlalchemy] Curious Problem
Hi all,
I just discovered something weird when doing concurrency testing with
my
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Michele Simionato
Sent: 26 August 2009 13:40
To: sqlalchemy
Subject: [sqlalchemy] from a sqlalchemy table to the
corresponding CREATE TABLE sql code
A part from setting
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Stephen Hansen
Sent: 25 August 2009 07:34
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Tracking Last Update timestamp for models
Hi all.
I'm working on converting
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of john smallberries
Sent: 24 August 2009 08:51
To: sqlalchemy
Subject: [sqlalchemy] negative indexes in query slices?
I just tried limiting a query to the final 10 items of a
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Laurent Rahuel
Sent: 24 August 2009 12:16
To: sqlalchemy
Subject: [sqlalchemy] ForeignKey on a ForeignKey
Hi all,
I'm stucked with a problem I'm not able to solve (SA
Faheem Mitha wrote:
Hi,
The following script is then followed by its output, and
finally by the
table output.
I don't get what is going on here. Yes, I should commit the
session, and
the table is empty as expected, but why does the id keep
incrementing on
successive runs, and
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911
Sent: 21 August 2009 10:25
To: sqlalchemy
Subject: [sqlalchemy] Re: index in SA
i tried
class MyClass:
__tablename__ = 'my_table'
id =
Faheem Mitha wrote:
Thanks for the fast and helpful response. This looks like an artifact
of
how I am creating the table. I wonder if this would still show up if I
explicitly specified the id. I could check this. Also, presumably if I
had
other cols in the table, they wouldn't show up in
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of darkblueB
Sent: 19 August 2009 02:58
To: sqlalchemy
Subject: [sqlalchemy] Re: new questions
Hi Simon
thanks for the reply.. Your second part is straightforward..
The first
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of darkblueB
Sent: 17 August 2009 06:31
To: sqlalchemy
Subject: [sqlalchemy] new questions
Hi-
I have just read a lot and gone through some exercises, but am at an
early
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Michele Simionato
Sent: 17 August 2009 16:11
To: sqlalchemy
Subject: [sqlalchemy] renaming columns
There should be an easy way to do this, but I cannot find it in the
Hi,
Does accessing a backref always have to issue SQL, even if the object to
be loaded already exists in the identity map? For example, if I have a
many-to-one lazy-loaded relationship from Master to Detail with a
backref, the statement master.details[0].master will issue SQL for the
'.master'
I wrote:
Hi,
Does accessing a backref always have to issue SQL, even if
the object to
be loaded already exists in the identity map? For example, if I have a
many-to-one lazy-loaded relationship from Master to Detail with a
backref, the statement master.details[0].master will issue
SQL
Michael Bayer wrote:
King Simon-NFHD78 wrote:
to
master_id = sa.Column(sa.Integer,
sa.ForeignKey(Master.__table__.c.id))
...and now it seems to work! So is this a bug?
yes, that would be a bug. There are some other scenarios
where this kind
of thing occurs (lazy clause
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of naktinis
Sent: 27 July 2009 13:07
To: sqlalchemy
Subject: [sqlalchemy] Session mapper and Class.query() method
I've seen that Session.mapper is deprecated. While I agree that
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Randy Syring
Sent: 23 July 2009 07:23
To: sqlalchemy
Subject: [sqlalchemy] Re: autoload of db view treating
columns as Decimal
Well, I am not really sure what the problem
On Jun 23, 3:32 pm, Ash ashishsinghbha...@gmail.com wrote:
Hello,
I am tryin to make the dynamic where clause using
append_whereclause.
But how i can do that, For eg :
I have a==b and c in (1,2,3,4) or d like %s
So i made three sqlalchemy expression
1. a==b
2. c in
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Hollister
Sent: 20 June 2009 02:15
To: sqlalchemy
Subject: [sqlalchemy] Re: aggregation with count and
webhelpers.paginate
Well, that worked great:
q =
George Sakkis wrote:
Is there a (public) API for getting the column names of a given Query
instance and other similar introspection needs ? I didn't find
anything related in the docs but after digging in the code I came up
with
col_names = [e._result_label for e in q._entities]
but
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Marcin Krol
Sent: 28 May 2009 10:09
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] This join does not fill in the collection
Hello everyone,
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Marcin Krol
Sent: 28 May 2009 13:57
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: This join does not fill in the collection
Hello Simon,
This answered my
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of JanW
Sent: 17 April 2009 13:18
To: sqlalchemy
Subject: [sqlalchemy] mapping class against arbitrary SQL expression
Hi,
is there a way to map a class against an arbitrary
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of JanW
Sent: 17 April 2009 14:45
To: sqlalchemy
Subject: [sqlalchemy] Re: mapping class against arbitrary SQL
expression
OK, thanks,
it does work if you make an alias on
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Tanmoy
Sent: 03 April 2009 14:30
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: Insertion issues
import sqlalchemy
from sqlalchemy import *
engine =
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Sanjay
Sent: 27 February 2009 05:52
To: sqlalchemy
Subject: [sqlalchemy] Class.query vs DBSession.query(Class)
Hi,
There are two styles of writing code for querying: the
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of bsdemon
Sent: 24 February 2009 20:22
To: sqlalchemy
Subject: [sqlalchemy] Separating session and db/models definitions
Hello.
I have the following states of things:
1) I
Could you use the python 'operator' module
(http://docs.python.org/library/operator.html)?
Eg. (untested):
import operator
operations = {
'+': operator.add,
'-': operator.sub,
# etc.
}
def combine_columns(op, *cols):
return operations[op](*cols)
sum_column =
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of
mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
Sent: 10 February 2009 19:13
To: sqlalchemy
Subject: [sqlalchemy] altering tables
[snip]
I'd like to update the
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of camlost
Sent: 09 February 2009 09:18
To: sqlalchemy
Subject: [sqlalchemy] classes in separate files
Hi, could someone advice me, please, how to split classes into
individual
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Nathan Harmston
Sent: 30 January 2009 13:15
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Using orderedlist with a secondary table
Hi,
I am currently trying to make
Would None (ie. SQL NULL) be a valid polymorphic identity?
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer
Sent: 30 January 2009 17:06
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re:
, 2009, at 12:19 PM, King Simon-NFHD78 wrote:
Would None (ie. SQL NULL) be a valid polymorphic identity?
it becomes that issue where we just need some kind of constant to
represent THIS_IS_NOT_DEFINED, so that we know when
polymorphic_identity is defined or not. it's
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Faheem Mitha
Sent: 27 January 2009 22:41
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] the return type of conn.execute(text())
Hi,
Today I attempted to serialize
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Faheem Mitha
Sent: 20 January 2009 22:05
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] passing tuple argument into
sqlalchemy.sql.text string
Hi,
I've got a
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of abhishek
Sent: 20 January 2009 14:26
To: sqlalchemy
Subject: [sqlalchemy] how to use model.py file across
different applications
Hello all,
I have been using SQL Alchemy
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Andreas Jung
Sent: 19 December 2008 06:30
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: Efficient dictificationof result sets
On 19.12.2008 2:57 Uhr, Michael Bayer
SQLALchemy doesn't (directly) contain functions for altering tables. You
may be interested in the sqlalchemy-migrate project:
http://code.google.com/p/sqlalchemy-migrate/
The first example on this page shows how to add a column:
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Faheem Mitha
Sent: 04 December 2008 20:43
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] returning primary key of object without
know what it is called.
Hi,
I'm trying to
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Doug Farrell
Sent: 28 November 2008 18:22
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] New instance ExtraStat with identity
key (...) conflicts with persistent instance ExtraStat
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of SinJax
Sent: 21 November 2008 10:43
To: sqlalchemy
Subject: [sqlalchemy] Re: ORM mapping with Elixir compared to
raw cursor query
[SNIP]
sql =
SELECT annotations.id AS
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of
---[EMAIL PROTECTED]@il06exr02.mot.com
Sent: 18 November 2008 10:04
To: sqlalchemy
Subject: [sqlalchemy] Re: Info needed regarding the use of cascade
Thank you Michael ,
you
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Allen Bierbaum
Sent: 14 November 2008 16:40
To: sqlalchemy
Subject: [sqlalchemy] Re: Using deferred with declarative
Does anyone have any ideas on this?
Does declarative simply not
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of John Hunter
Sent: 11 November 2008 01:54
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: select where field=max(field)
On Mon, Nov 10, 2008 at 11:10 AM, Michael Bayer
[EMAIL
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of John Hunter
Sent: 10 November 2008 14:07
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: select where field=max(field)
On Mon, Nov 10, 2008 at 4:33 AM, King Simon-NFHD78
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of joelanman
Sent: 10 November 2008 00:21
To: sqlalchemy
Subject: [sqlalchemy] Re: Memory leak - is session.close() sufficient?
Thanks for all the advice - I've changed my unicode settings
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of John Hunter
Sent: 08 November 2008 05:09
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: select where field=max(field)
[SNIP]
Here is a query that lists the sum(pnl) for each
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of alex bodnaru
Sent: 15 October 2008 11:00
To: SQLAlchemy
Subject: [sqlalchemy] how to print a constructed query with
it's parameters?
hello friends,
in order to debug my code, i
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Randy Syring
Sent: 30 September 2008 07:17
To: sqlalchemy
Subject: [sqlalchemy] Re: How to turn off UPDATE on child
objects when deleting parent object
On Sep 30, 2:14 am, Randy Syring
Heston wrote:
[SNIP]
Above you talk about a global module in the application which
creates the
Base and metadata, but I don't understand how these can then
be accessed by
other classes around the application?
Do you have any good sample code or a link to a decent
tutorial? Seems
Tai Tran wrote:
[snip]
class PC(object):
...
def destroySelf(self):
db_session = Session()
...
for port in self.ports:
port.destroySelf()
...
db_session.delete(self)
...
class Port(object):
...
Lilo wrote:
My understanding of this query_chooser is that it's used when you want
to execute orm's sql rather than raw sql.
I don't quite understand what is visit_binary function do from
attribute_shard.py example. What does it mean binary.operator,
binary.left, binary.right.clause and
-Original Message-
From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of jack2318
Sent: 11 June 2008 17:50
To: sqlalchemy
Subject: [sqlalchemy] text
I tried very simple test:
s = text(SELECT COUNT(*) FROM table WHERE field LIKE 'something')
count =
Lukasz Szybalski wrote:
I have mysqldb installed in the system wide install how do I tell
virtualenv to use it?
I don't see a need to install it in virtualenv again so I guess I just
have to givea right path? How, and in which file?
Thanks,
Lucas
File
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of lilo
Sent: 10 June 2008 17:23
To: sqlalchemy
Subject: [sqlalchemy] select db engine with create_session
can someone tell me how session chooses the right db engine to insert
records in
Yannick Gingras wrote:
Greetings Alchemists,
Is it possible to define a hook in a mapped class that will
be called
to test the sanity of an instance before it gets committed?
As an example:
class Item(object):
def _pre_commit(self):
assert (self.dry_weight +
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Withers
Sent: 13 February 2008 13:51
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: schema changes
Michael Bayer wrote:
What if they exist but don't match the spec
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of maxi
Sent: 08 February 2008 14:30
To: sqlalchemy
Subject: [sqlalchemy] Re: Search in object list by field value
Thanks Simon,
I was doing of that manner.
Now, is advisable implement
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of maxi
Sent: 08 February 2008 13:47
To: sqlalchemy
Subject: [sqlalchemy] Re: Search in object list by field value
On 8 feb, 09:58, svilen [EMAIL PROTECTED] wrote:
On Friday 08 February
Hi,
If your database is set up to generate auto-incrementing primary keys on
INSERT (such as a MySQL auto-incrementing column), then SA will retrieve
the new value when the object is flushed to the database. When the
object is constructed, the primary key will be None until you flush the
If you're using easy_install to install them, you should be able to
install them with the '-m' (--multiversion) switch. See:
http://peak.telecommunity.com/DevCenter/EasyInstall#command-line-options
Choosing the version you want to use in your application is then done
like this:
import
Would create_date = '2007-01-01' and create_date '2008-01-01' be
acceptable?
If so, something like this should work
from sqlalchemy import and_
from datetime import date
data = Table.query().filter(and_([Mikropost.c.create_date = date(2007,
1, 1),
sqlalchemy_schemadisplay.py is not part of the SQLAlchemy distribution -
it's a separate script attached to that wiki page. You can download it
from the link at the bottom of the page.
Hope that helps,
Simon
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL
Hi,
I'm connecting to an ancient version of MySQL (3.23.58) that (as far as
I can tell) doesn't support basic JOIN table ON condition syntax
Ie. this gives a syntax error:
SELECT * FROM productversions pv
JOIN producttypes pt ON pv.producttype = pt.producttype
Whereas this is fine:
Felix Schwarz wrote:
Hi,
after reading the docs [1] I thought that something like
session.query(User).filter(User.c.id 3)[0]
should work even if the filter clause does not return any rows.
But - compliant with Python's behavior - SQLAlchemy raises an
IndexError.
(...)
File
Michael Bayer wrote:
On Dec 11, 2007, at 10:07 AM, King Simon-NFHD78 wrote:
I assume the problem is that my date_created column isn't
immediately
available at the 'after_insert' stage, because it is
generated in the
SQL INSERT statement, but hasn't been read back from
Michael Bayer wrote
On Dec 12, 2007, at 9:04 AM, King Simon-NFHD78 wrote:
Hi,
I'm connecting to an ancient version of MySQL (3.23.58)
that (as far
as
I can tell) doesn't support basic JOIN table ON
condition syntax
Ie. this gives a syntax error:
SELECT * FROM
Jason kirtland wrote:
King Simon-NFHD78 wrote:
Hi,
I'm connecting to an ancient version of MySQL (3.23.58)
that (as far as
I can tell) doesn't support basic JOIN table ON
condition syntax
Ie. this gives a syntax error:
SELECT * FROM productversions pv
JOIN
It may not matter to you, but I wouldn't have thought this would be a
very efficient query, because the database is going to have to call the
DATE_FORMAT function twice for every row in your table. I would have
thought a more efficient version would be one that asks for all rows
between the first
Hi,
I used to be able to iterate over mapper.properties.items() to get the
name of each mapped property along with the object that implements it.
However, in 0.4.1, trying to do this results in a NotImplementedError
telling me to use iterate_properties and get_property instead, but I
can't see a
svilen wrote:
On Tuesday 11 December 2007 13:13:37 King Simon-NFHD78 wrote:
Hi,
I used to be able to iterate over mapper.properties.items() to get
the name of each mapped property along with the object that
implements it. However, in 0.4.1, trying to do this results
Felix Schwarz wrote:
I have a question which I think is similar enough to be asked
in the same
thread: I have a set of quite simple migration scripts which
us SQLAlchemy 0.4
and Elixir 0.4. I do extract data from the old legacy (MySQL)
database with
SQLAlchemy and put this data into
imgrey wrote:
Based on my observations it happens only with concurent inserts/
updates.
One thread :
{{{
f_table.insert().execute()
session.flush()
transaction = session.begin()
nested = session.begin_nested()
try:
f_table.insert().execute()
except IntegrityError:
#record is
It may not help in your situation, but did you know that you can also
index the row with the Column instances themselves
Ie: row[table.c.column]
Simon
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Yuri Pimenov
Sent: 27 November 2007
You may be interested in an older thread, 'How to get list of
relations':
http://groups.google.com/group/sqlalchemy/browse_thread/thread/ff03af921
eb12acb/861597e8a72f5e6f
Simon
-Original Message-
From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Christophe
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of klaus
Sent: 22 October 2007 11:33
To: sqlalchemy
Subject: [sqlalchemy] Please add some __len__ methods
Hi all,
I wonder why some classes/objects implement part of a list interface -
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Ken Pierce
Sent: 29 September 2007 00:21
To: sqlalchemy
Subject: [sqlalchemy] one-to-many access and modification
Hello all,
I just got into using sqlalchemy today and I have a
Noufal wrote:
snip
I create two tables like so
run_table = sa.Table('runs',md,
sa.Column('rid', sa.Integer,
primary_key=True),
sa.Column('cmdline', sa.String(250)),
sa.Column('hostname',
Hi,
The ancient version of MySQL that I am connecting to (3.23.58) doesn't
support the syntax 'LIMIT limit OFFSET offset' syntax. Instead, it
uses LIMIT offset, limit. This is described in the docs, but it
doesn't say what version introduced the more standard syntax:
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of mc
Sent: 15 August 2007 14:23
To: sqlalchemy
Subject: [sqlalchemy] Outerjoin with a subset of columns
Hi,
Note the following code:
oj=outerjoin(s,f)
Hi,
I think this is a pretty good match for Joined Table polymorphic
inheritance, as described in the docs
http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_inhe
ritance_joined. Your nodes_table would correspond to the employees
table, and the 'subclass' tables such as video
databases/mysql.py has this snippet in create_connect_args (0.3.10):
# FOUND_ROWS must be set in CLIENT_FLAGS for to enable
# supports_sane_rowcount.
client_flag = opts.get('client_flag', 0)
if self.dbapi is not None:
try:
import
You want something like this:
user_table = Table('users', metadata, Column('userid', String(8)))
user_table.create(checkfirst=True)
# or
# metadata.create_all(checkfirst=True)
Documentation is at:
http://www.sqlalchemy.org/docs/metadata.html#metadata_creating
Hope that helps,
Simon
What do you mean by a model? If you are talking about an instance of a
mapped class, you could try something like this (untested):
def model_to_dict(instance):
model_dict = {}
for propname in instance.mapper.props:
model_dict[propname] = getattr(instance, propname)
return
SQLAlchemy Column objects override the '==' operator (and many others as
well) so that python expressions get converted to appropriate SQL
expressions.
It's mentioned (briefly) here:
http://www.sqlalchemy.org/docs/sqlconstruction.html#sql_whereclause
Hope that helps,
Simon
-Original
The way to hook most parts of the ORM is by creating a MapperExtension
http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_exte
nding. Basically, define a subclass of MapperExtension, overriding
whichever method you are interested in (possibly append_result or
create_instance in
Hi,
I just noticed that autoloading of tables on old versions of MySQL is
broken (I'm using 3.23.58, but I believe the problem will occur up to
4.1.1)
The problem is that reflecttable tries to use the
'character_set_results' system variable, which was only introduced in
4.1.1. The attached patch
I think the answer to this partly depends on which parts of SA you are
using, and how your databases are set up. If all the databases have
different schemas, and you are using the low-level SA API (or your ORM
objects are each defined against a single database), I would probably
use a
Max Ischenko wrote:
On May 10, 4:38 pm, King Simon-NFHD78 [EMAIL PROTECTED]
wrote:
You're halfway there with your 'posts' relation. I think if you pass
backref='author' in your relation, then WordpressPost
objects will get
an 'author' property which points back to the WordpressUser
Pirkka wrote:
I started migrating from ActiveMapper to Elixir, and have been
wrestling with this for hours:
DBAPIError: (Connection failed) (OperationalError) (2005, Unknown
MySQL server host '/Applications/MAMP/tmp/mysql/mysql.sock' (1))
Here are the command parameters that sqlalchemy
Hi,
Your TaskExtension class doesn't have a translate_row method, which
apparently is part of the MapperExtension interface (although it doesn't
appear in the docs). From the source code (in orm/mapper.py):
def translate_row(self, mapper, context, row):
Perform pre-processing on the
Disrupt07 wrote:
I have a table storing users' info.
table: userinfo
columns: name, surname, age, location, ...
I need to query this table using SQLAlchemy's ORM methods (e.g.
select(), select_by(), get_by()). The query should be like
SELECT * FROM userinfo WHERE name LIKE 'Ben%'
Disrupt07 wrote
@Simon
Thanks. But what is your_query? Is it SQLAlchemy or pure SQL?
It is a Query object, as described here:
http://www.sqlalchemy.org/docs/datamapping.html
If you haven't read them yet, I'd recommend working through a tutorial -
I found this one really helpful:
Disrupt07 wrote
What is sqlalchemy.orm.attributes.InstrumentedList?
I need to use the sqlalchemy.orm.attributes.InstrumentedList type in
my Python controller methods and need to check if the type of another
object is of type sqlalchemy.orm.attributes.InstrumentedList. How can
I do
Roger Demetrescu wrote:
On 4/11/07, King Simon-NFHD78 [EMAIL PROTECTED] wrote:
I've got no idea about the source of the problem, but it
would probably
be helpful if you could provide stack traces from the exceptions, if
that's possible.
Do you mean using the traceback module
Huy wrote:
Hi,
When using the generative limit() offset() or order_by calls
on mapper
query, the sql generated looks weird.
I get something like
select table1.* table2.*
from (select table1a.id from table1a limit 20 offset 0 order by
table1.col) as table_row, table1 join
to model.
On Mar 28, 2007, at 10:39 AM, King Simon-NFHD78 wrote:
a_table = Table('a', metadata,
Column('id', Integer, primary_key=True),
Column('name', String(16)),
)
b_table = Table
This caught me out a couple of weeks ago, and I've seen a couple of
other similar questions as well. You need to add 'correlate=False' to
the nested select.
I wonder if this should be added to the FAQ?
Hope that helps,
Simon
-Original Message-
From: sqlalchemy@googlegroups.com
Michael Bayer wrote:
On Mar 17, 2007, at 11:39 AM, Simon King wrote:
I had assumed that post_update was only necessary when you are
inserting two rows that are mutually dependent, but in this case I
wasn't inserting either a ReleaseLine or a Label. I suppose
post_update can
101 - 200 of 217 matches
Mail list logo