will disable escaping; don't know if the Python modules
support that feature.
http://docs.sqlalchemy.org/en/rel_0_8/core/expression_api.html?highlight=.like#sqlalchemy.sql.operators.ColumnOperators.like
--
Mike Conley
On Fri, Jun 28, 2013 at 6:19 AM, Simon King si...@simonking.org.uk wrote:
On Fri
The Oracle database only has one date type, and it includes time. If you
require date only it is up to you to extract the date. Alternatively, if
you really care about date only for all usage of that column, store it with
a time of 00:00:00.
On Mar 30, 2012 8:08 AM, jo jose.soa...@sferacarta.com
here is that in this case we are creating an
explicit SQL delete statement without adding Peripheral instances to the
session and so there is no knowledge that a related Actuator exists. Someone
else might be able to give a better explanation.
--
Mike Conley
On Tue, Oct 18, 2011 at 9:03 AM
On Wed, Sep 28, 2011 at 8:56 AM, Michael Bayer mike...@zzzcomputing.comwrote:
On Sep 28, 2011, at 9:47 AM, Chris Withers wrote:
On 28/09/2011 14:09, Michael Bayer wrote:
I'm doing engine.execute('drop table if exists %s' + table.name) in the
meantime, which just feels icky...
oh
, MSPResponse) should work. You get result
rows with 2 items: a scalar for original_name and a MSPResponse object.
You can then process the result like this:
for row in result:
### access Files.original_name as row.original_name
### access MSPResponse as row[1]
--
Mike Conley
--
You received
Don't know what database you are using, but this looks like you are trying
to cast the string 'testing' to an integer and the database engine says you
can't do that.
--
Mike Conley
On Wed, Sep 14, 2011 at 9:51 AM, pravin battula pravin.batt...@gmail.comwrote:
Sorry for the spelling
the listener
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options
)).\
group_by(FilmParticipation.PartType)
--
Mike Conley
On Mon, Aug 29, 2011 at 3:05 PM, nospam lhfied...@gmail.com wrote:
I'm trying to construct a query in sqlalchemy similiar to this:
SELECT FilmParticipation.PartType, COUNT(*) AS Amount,
100*COUNT(*) /(SELECT count(*) FROM
, ForeignKey(Parent.id))
parent = relation(Parent, backref=backref('children',
cascade=save-update,merge))
sess.add(Parent(children=[Child(),Child()]))
sess.commit()
p = sess.query(Parent).first()
sess.delete(p)
sess.commit()
--
Mike Conley
On Fri, Aug 19, 2011 at 12:10 PM, Mark Erbaugh m
of synchronize_session parameter to determine what is
needed in your application
--
Mike Conley
--
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 unsubscribe from this group, send email
transaction come from?
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com
them unless you reflected
the table or you coded the server side default in your code by hand.
--
Mike Conley
--
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 unsubscribe from
0.7 has support for window functions. I haven't tried it in a subquery.
http://www.sqlalchemy.org/docs/core/tutorial.html?highlight=window#window-functions
--
Mike Conley
On Wed, Jul 27, 2011 at 9:16 AM, Eduardo ruche...@googlemail.com wrote:
I have the following statement :
SELECT name
to give up to the UOW code. After all
if sequence is important this could very well be application dependent and
the UOW might have to get really sophisticated to guess right. That
increases the risk of taking a performance hit in the 90+% of cases where it
doesn't matter.
--
Mike Conley
--
You
before the connect() to get it to echo.
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr
I saw that, but unless setting echo actually changes the Python logger
configuration I don't see how it applies here.
--
Mike Conley
On Wed, Jul 27, 2011 at 12:31 PM, King Simon-NFHD78
simon.k...@motorolasolutions.com wrote:
-Original Message-
From: sqlalchemy@googlegroups.com
in
http://www.sqlalchemy.org/docs/core/schema.html
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr
()
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit
WHERE book.title = ? AND book.title = ? AND book.title = ? AND book.title =
?
--
Mike Conley
--
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 unsubscribe from this group, send email
see
http://www.sqlalchemy.org/docs/orm/query.html#sqlalchemy.orm.query.Query.update
We use session.query(..).update(..,synchronize_session=False) for
updates where we are sure about the criteria and session state. This
generates an update statement without any selects.
--
Mike Conley
http://www.sqlalchemy.org/docs/06/orm/query.html#sqlalchemy.orm.query.Query.join
for example: if the items relationship isn't declared
.join((Item,User.id==Item.user_id))
generates the same SQL
--
Mike Conley
--
You received this message because you are subscribed to the Google Groups
2011/5/30 Cornelius Kölbel cornelius.koel...@lsexperts.de
OK,
after some more reading and thinking, I think i managed it this way:
self.session.add(at)
self.session.flush()
# At this point at contains the primary key id
at.signature = self._sign( at )
,primary_key=True)
confirmed = Column(Boolean,default=False, nullable=False)
values = relationship(ModelAttributeValue)
attr = ModelAttribute(confirmed=True)
attr.values.append(ModelAttributeValue(value=1))
session.add(attr)
session.commit()
--
Mike Conley
--
You received this message because
, then virtualenv
might be the way to go.
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com
Use
people.married_status == None
to check for NULL
--
Mike Conley
--
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 unsubscribe from this group, send email
and the group.
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit
Take a look at using ordering_list for the collection class on your
relation. You add a position in season and SQLAlchemy will maintain the
value.
http://www.sqlalchemy.org/docs/orm/extensions/orderinglist.html
--
Mike Conley
--
You received this message because you are subscribed
--
Mike Conley
--
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 unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit
):
__tablename__ = 'groups'
group_id = Column(Integer, primary_key=True)
group_nm = Column(String(10))
users = relation('User', backref='grp',
primaryjoin='User.group_id==Group.group_id',
foreign_keys='User.group_id')
--
Mike Conley
--
You received this message because you
the
IN operator in SQL.) Thanks in advance.
Did you try something like
session.query(MyClass).filter(MyClass.id.in_([...list of ids...])).all()
--
Mike Conley
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy
with
the rest of the relationship configuration.
--
Mike Conley
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr
,
deals.c.deal_status=='active'))
This is one advantage of using declarative because the primaryjoin can be
defined as a string that will not be compiled until later. That can be
deferred until after everything is defined.
--
Mike Conley
On Thu, Nov 11, 2010 at 1:33 PM, Jonathan Gardner
jgard
Check the docs, create_all has an optional tables= parameter.
On Oct 27, 2010 8:18 AM, Martijn Moeling mart...@xs4us.nu wrote:
Hi,
I have a huge definition module where I create Python objects and use
declarative.
Since not all databases (Multiple for different customers) need all tables I
do
On Thu, Aug 26, 2010 at 4:21 PM, Michael Hipp mich...@hipp.com wrote:
Is there a way to set 'echo' at any time? Everything I can find sets it
when the engine is created and doesn't seem to change it afterward.
Thanks,
Michael
You can assign the engine.echo property to True or False any
On Wed, Aug 25, 2010 at 1:30 PM, keekychen.shared
keekychen.sha...@gmail.com wrote:
How to test if an existing database file is a valid sqlite3 format
file before using sqlalchemy?
Here is function we use
import os, os.path as osp
try:
from pysqlite2 import dbapi2 as sqlite
except:
On Thu, Aug 5, 2010 at 6:29 AM, Michael Hipp mich...@hipp.com wrote:
On 8/4/2010 10:03 PM, Mike Conley wrote:
Thanks. But by the time I'm done there will be at least a dozen of those
otherfiles. Which one do I get Base from?
You can put the declaration of Base in a common file
On Wed, Aug 4, 2010 at 9:39 PM, Michael Hipp mich...@hipp.com wrote:
Can someone tell me why this code won't create any tables? The tables are
defined in another file that calls declarative_base().
I presume the problem is that it doesn't know which tables to create. If
so, how do I tell it
ON Shot.id = Asset.shot_id
WHERE Shot.id = :id_1
--
Mike Conley
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr
On Tue, Dec 22, 2009 at 2:34 AM, jo jose.soa...@sferacarta.com wrote:
Hi all,
I'm trying to solve this error...
File
/home/sfera/release/sicer/BASE/controller/controlli/sopralluogo.py,
line 645, in verifiche
Piano.c.data_inizio =data.get('data_sop') ,
File
.
There might be a simpler approach, but it looks like this one should work.
--
Mike Conley
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email
to this because using the .c. with ORM
didn't feel natural.
--
Mike Conley
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy
Why not use update({ESMagicNumber.last_access: datetime.datetime.now()}) ?
one advantage of this syntax is that Python will raise an exception that
last_access does not exist.
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this
query() will return a tuple of the items listed in the query. In your query
you are asking for a and b objects, so that is what you get. If you want the
result to be individual columns directly, you need to list them
individually.
db.query(a.a, a.acol1, b.b, b.bcol1).\
this should work OK if you fix the ForeignKey definitions
Column('parent_id', Integer, ForeignKey('parent.parent_id'))
or
Column('parent_id', Integer,ForeignKey(parent_table.c.parent_id))
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To
On Fri, Nov 20, 2009 at 5:14 PM, Mariano Mara mariano.m...@gmail.comwrote:
... or, at least, is weird for me :)
Hi everyone. I'm running a pylons controller
with the following instruction:
meta.Session.query(ESMagicNumber).filter(
And you do need to quote the column name in order_by also.
session.query(func.sum(X.amount).label('tot_amount')).group_by(X.date).order_by('tot_amount').limit(10)
generates code
SELECT sum(x.amount) AS tot_amount
FROM x GROUP BY x.date ORDER BY tot_amount
LIMIT 10 OFFSET 0
I haven't seen how to do this using the relation directly. I do:
session.query(Someclass).join(OtherClass).filter_by(OtherClass.field==somevalue)
I did do some experimenting with a more abstract approach, but did not find
any need in my application. The only advantage is that it takes away the
just in
the unit testing stage.
--
Mike Conley
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send
')
a=A()
b=B()
x={22:33} # does not loop if dictionary is empty
a.b.append(b, x) # -- goes into infinite loop, should be a.b.append(b)
which works OK
--
Mike Conley
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Thanks, that helps. It looks like the problem is around a M:N relationship.
There is some complex logic about whether or not the row on the :N side of
the relation should be copied or the original referenced. The related
maintenance of the supporting association table causes the update problem.
That is pretty much what I expected. Considering it only occurs if the
developer writes incorrect code, I wouldn't want to make the performance
tradeoff.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy
On Tue, Nov 10, 2009 at 9:55 PM, jcm jonmast...@gmail.com wrote:
Folks,
I could do with some decent docs on subqueries. I've tried to play
with what's on the website, but it's not helping me to convert the
following into an SQLAlchemy subquery:
select * from symbollistentries WHERE
The id is generate by the database engine, not SQLAlchemy, so session.add()
does nothing to push your object to the database and generate the id. You
need to execute session.flush() after session.add() to write the book to the
database and generate the id. After the flush() operation, the book id
Using your class definitions, it seems to work. What is different?
Base.metadata.bind=create_engine('sqlite:///')
Base.metadata.create_all()
session=sessionmaker()()
bk_ids = {}
for title in ('Tom Sawyer', 'Huck Finn'):
book = Book(title=title)
session.add(book)
session.flush()
Something like this? The association table is declared in the relationships,
but never referenced when creating or accessing objects.
class Assoc(Base):
__tablename__ = 'assoc'
parent = Column(Integer, ForeignKey('m_to_n.id'), primary_key=True)
child = Column(Integer,
of parent pointers in a child record; that leads
to the requirement for an association table. No other way to do it.
SQLAlchemy cannot change the data modeling needed here, but constructs
available in SA can make the coding easier for managing the association
table.
Mike Conley
there's nothing built in that does that.you might build your own using
the way that tometadata() works to provide clues.
So, something like this? (Ignoring schema for now)
def copyinmetadata(table, to_name):
Make copy of table in own metadata
metadata = table.metadata
Is it possible to rename and/or copy a table object in metadata?
That is I have a table
t1 = Table('t1', metadata, ...)
I want a copy of that table as t2 in the same metadata, or rename it to t2.
For right now, this is metadata manipulation only ignoring the underlying
database.
--
Mike
Looks like you are trying to mix ORM and SQL expression constructs.
Also, Insert() objects should be constructed via the insert() function.
Try this
conn = session.connection() # get handle to the session's connection
t = conn.begin()
res = conn.execute(insert(t_table).values(id=None,pv=6))
On Mon, Oct 26, 2009 at 10:09 PM, Bobby Impollonia bob...@gmail.com wrote:
You can also create a view mapped to that union and use that as a
virtual table so that you don't have to repeat the union specification
for every query:
http://www.w3schools.com/Sql/sql_view.asp
I don't know if
Only a couple of months late, but here is the final working recipe:
class A(Base):
__tablename__ = 'tbl_a'
id = Column(Integer, primary_key=True)
data = Column(String)
class B(Base):
__tablename__ = 'tbl_b'
id = Column(Integer, primary_key=True)
data = Column(String)
I see, but I need a proper shallow copy instead, with every
attribute.. Is there no way? :/
What is missed?
I am not sure what you mean by shallow copy. The fact that there are
relations to be lazy loaded is present in the new object when instantiated.
Obviously the objects pointed to by the
On Mon, Oct 26, 2009 at 9:13 AM, Joril jor...@gmail.com wrote:
On 26 Ott, 13:41, Mike Conley mconl...@gmail.com wrote:
I see, but I need a proper shallow copy instead, with every
attribute.. Is there no way? :/
What is missed?
I am not sure what you mean by shallow copy. The fact
Blurb at 0xeb9f50 with
identity key (class '__main__.Blurb', (99, 1)) conflicts with persistent
instance Blurb at 0xecd2d0
--
Mike Conley
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post
On Fri, Oct 23, 2009 at 12:45 PM, jeff jeff.sie...@seagate.com wrote:
I would like to save a number of these in a database so size is
important (the serialized select() was somewhat large...) so I would
like to get the string representation of the raw SQL directly useable
by sqlalchemy if
On Fri, Oct 23, 2009 at 1:47 PM, Michael Bayer mike...@zzzcomputing.comwrote:
Much easier to use serializer.
I agree with that.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this
On Fri, Oct 23, 2009 at 12:40 PM, Joril jor...@gmail.com wrote:
Hi everyone!
I'm trying to automatically build a shallow copy of a SA-mapped
object.. At the moment my function is just:
newobj = src.__class__()
for prop in class_mapper(src.__class__).iterate_properties:
setattr(newobj,
add allow_null_pks to your mapper arguments
See
http://www.sqlalchemy.org/docs/05/reference/orm/mapping.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to
On Thu, Oct 15, 2009 at 9:21 AM, alexbodn.gro...@gmail.com wrote:
thanks a lot mike, it's working great now.
but this flag should be implied if one of the primary key fields is
nullable (especially since it's not nullable by default).
what would you think?
You can argue just as easily
Now I want to build a query to get all Workstations which are related
to server 'foo'.
This works:
ws = DBSession.query(WorkStation).select_from(join(WorkStation,
DHCPServer)).filter(DHCPServer.label == 'foo').all()
but It's too complex. Is there an easier way?
Something like:
Assuming you have the foreign keys defined, it should be fairly easy.
session.query(Project).join(Country).order_by(Country.name)
if you don't have the keys defined, you will need to add the join condition
to the .join()
--
Mike Conley
Use rowcount property of the ResultProxy returned from delete/update
result = conn.execute(tbl.delete())
count = result.rowcount
Note that the quality of the number will depend on the underlying database
and Python dbapi.
--~--~-~--~~~---~--~~
You received this
The column is available as e.Namefile, no need to subscript with numbers.
On Mon, Sep 28, 2009 at 6:07 AM, Christian Démolis
christiandemo...@gmail.com wrote:
Hi everybody,
I have a little problem with session.query.
I try to optimize my queries with only attributes that i need.
When we
You need to use argumentpost_update=True
on your thumbnails relation
http://www.sqlalchemy.org/docs/05/mappers.html#rows-that-point-to-themselves-mutually-dependent-rows
http://www.sqlalchemy.org/docs/05/mappers.html#rows-that-point-to-themselves-mutually-dependent-rowsHere
is a
Did you verify that the full query gives results?
SELECT table_name FROM all_tables
WHERE nvl(tablespace_name, 'no tablespace') NOT IN ('SYSTEM', 'SYSAUX')
AND owner = 'SCHEM';
I've been away from Oracle for a while, but I do remember it is unusual, but
still possible for user's tables to be in
What does the second query report for tablespace_name? SYSTEM?
If so, you need to talk to your DBA about why the default tablespace for
your owner is SYSTEM. Normally the system is configured to have user tables
go somewhere else.
From the SQLAlchemy side, the maintainers of
, primary_key=[s2.c.bar]) # same error using [t2.c.bar]
ArgumentError: Mapper Mapper|Two|%(31476816 anon)s could not assemble any
primary key columns for mapped table '%(31476816 anon)s'
--
Mike Conley
--~--~-~--~~~---~--~~
You received this message because you
Submitted ticket #1542
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to
If I understand this, you want to construct a query that returns the primary
keys in an arbitrary table?
Try this:
key_cols = [c for c in table.primary_key.columns]
session.query(*key_cols).all()
--~--~-~--~~~---~--~~
You received this message because you are
somehow?
--
Mike Conley
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to
sqlalchemy
= [MySessionExtension()]
to replace the existing extension or
session.extensions.append(MySessionExtension())
to add yours to the list
But understand the risk that this is modifying internals and might not work,
and no guarantee it will work in future versions.
--
Mike Conley
On Thu, Sep 10, 2009
As expected, the simple test works. Something else is happening.
In [7]: cpaste
Pasting code; enter '--' alone on the line to stop.
:Base=declarative_base()
:Base.metadata.bind = create_engine('sqlite:///', echo=True)
:class Foo(Base):
:__tablename__ = 'foo'
:id = Column(Integer,
Nothing hackish about it. The SQL is doing exactly what you want; union the
posting tables and join the result to users. Simple enough that the database
engine should construct a reasonable plan.
--
Mike Conley
On Wed, Sep 9, 2009 at 8:41 PM, Seth seedifferen...@gmail.com wrote:
Ok Mike
posted earlier about
labeling literals in the first query of a union. I'll reply to that thread
again when I have the answer completed.
--
Mike Conley
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group
here is the sample code I am using
http://pastebin.com/m6cd9c5dd
--
Mike Conley
On Wed, Sep 9, 2009 at 11:10 PM, Mike Conley mconl...@gmail.com wrote:
On Wed, Sep 9, 2009 at 10:46 PM, Michael Bayer
mike...@zzzcomputing.comwrote:
On Sep 9, 2009, at 8:41 PM, Seth wrote:
Ok Mike
Your assumption should be correct.
http://www.sqlalchemy.org/docs/05/reference/orm/mapping.html#sqlalchemy.orm.relation
On Tue, Sep 8, 2009 at 6:40 AM, Eloff dan.el...@gmail.com wrote:
Hi,
I see cascade='all, delete, delete-orphan' in the tutorial, but I
thought I read in the docs
See the documentation at
http://www.sqlalchemy.org/docs/05/sqlexpression.html#functions
Something like this
Using ORM mapped classes
session.query(Tabl.name, func.max(Tabl.cnt)).group_by(Tabl.name).all()
or SQL expression language
client
--
Mike Conley
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to
sqlalchemy
the compilation error.
--
Mike Conley
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email
bulk insert capability
is the INSERT ... SELECT FROM syntax.
DB API's, such as the Python DBAPI executemany() or SQLAlchemy, accept
something like a bulk insert, but actually generate multiple insert
statements.
--
Mike Conley
--~--~-~--~~~---~--~~
You received
AS somestuff, 'A' AS source
FROM a UNION SELECT b.data AS somestuff, 'B' AS source
FROM b) AS anon_1
The correct code would be
SELECT anon_1.somestuff AS somestuff, anon_1.source AS source
etc.
--
Mike Conley
--~--~-~--~~~---~--~~
You received
using Session.query.join(), the first parameter to
query() must be a mapped entity or an attribute of a mapped entity. Is that
true?
--
Mike Conley
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group
It works and will probably be OK. Using this style (query for user multiple
times) in a really big database could lead to a performance problem
depending on how the underlying database engine constructs a query plan. Try
it and see how it goes.
--
Mike Conley
On Fri, Aug 28, 2009 at 2:22 PM
Constraints are defined in __table_args__ try:
__table_args__ = (
UniqueConstraint('api_id', 'daskey_id', name='uix_1'),
{'mysql_engine':'InnoDB'})
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
AttributeError: 'NoneType' object has no attribute 'base_mapper'
Probably because the subq is first in the list and is not an entity
--
Mike Conley
On Thu, Aug 27, 2009 at 5:05 PM, Mike Conley mconl...@gmail.com wrote:
Assuming a declarative based class USER exists, then you can join each
statement
SQL would look something like this:
SELECT qry.a, qry.b, qry.c, user.x
FROM (SELECT a,b,c FROM p1
UNION ALL SELECT a,b,c FROM p2
UNION ALL SELECT a,b,c FROM p3) as qry
JOIN USER on qry.a = USER.a
but I can't seem to get this result in SQLAlchemy
--
Mike Conley
AS somestuff, anon_1.somelabel as somelabel
FROM (SELECT a.data AS somestuff, 'A' as somelabel
FROM a UNION ALL SELECT b.data AS data, 'B'
FROM b) AS anon_1
which will give the desired result
--
Mike Conley
--~--~-~--~~~---~--~~
You received this message because
is: when inserting many records, provide same value list for
each row.
--
Mike Conley
On Wed, Aug 26, 2009 at 5:36 AM, menuge men...@gmail.com wrote:
Hi all,
I d like to insert a list of dictionary in a simple MySQL table but, I
have a problem, in my case, the MySQL default values
Add cascade='delete-orphan' to the relation definition for children.
cascade='all,delete-orphan' is also a fairly common option.
See the documentation for other options in cascade.
http://www.sqlalchemy.org/docs/05/reference/orm/mapping.html#sqlalchemy.orm.relation
--
Mike Conley
On Wed
Did you try something like this?
q1=session.query(P1.userid, P1.extra, P1.title, P1.body)
q2=session.query(P2.userid, 'X', P2.title, P2.body)
q3=session.query(P3.userid, 'X', P3.title, P3.body)
q=q1.union_all(q2).union_all(q3)
--
Mike Conley
On Wed, Aug 26, 2009 at 10:45 PM, Seth
1 - 100 of 149 matches
Mail list logo