We use this recipe and in 0.7.5 it works ok with limit and offset.
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/old/DebugInlineParams
On Fri, Mar 9, 2012 at 10:32 AM, Randy Syring rsyr...@gmail.com wrote:
I found a recipe on stackoverflow for turning a query instance into a
string,
Thanks!
Great work! :)
On Sat, Jan 21, 2012 at 3:18 AM, Conor conor.edward.da...@gmail.com wrote:
def get_constraint_name(e):
# Unique constraint violations in PostgreSQL have error code 23505.
if e.orig.pgcode == 23505:
return re.search(r'^ERROR: duplicate key value violates
I need EmptyQuery because query that returns from my function used for
different cases,
and if I return [], it will raise error, because [] not has query methods
like order_by.
e.g.
query1 = getComments(user_id).order_by('comment.time_create desc')
query2 = getComments(user_id).order_by('id')
Thanks, but if I need allow nullable primary_keys it not works.
I tried:
user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='SET
NULL'), primary_key=True, nullable=True, server_default=text('NULL'))
it generates
CREATE TABLE user_ip (
user_id INTEGER DEFAULT NULL,
PRIMARY KEY
='
127.0.0.1/32')
and it raise error:
ArgumentError: Mapper Mapper|UserIp|user_ip could not assemble any primary
key columns for mapped table 'user_ip'
Thanks!
On Fri, Nov 11, 2011 at 2:35 PM, Wichert Akkerman wich...@wiggy.net wrote:
On 11/11/2011 11:20 AM, Alex K wrote:
Thanks, but if I
try doing:
level in row
instead of recompiling the query with __str__() each time, very expensive,
also not very accurate
Thanks!
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to
Maybe compiler from sqlalchemy can help me?
from sqlalchemy.sql import compiler
from sqlalchemy.sql.expression import text
t = text(st)
c = compiler.SQLCompiler(db.engine.dialect, t)
and now I don't know how pass the params dict to compiler.
Thanks.
On Fri, Oct 21, 2011 at 6:40 PM, Michael
On Wed, Oct 19, 2011 at 7:57 PM, Michael Bayer mike...@zzzcomputing.comwrote:
but I can't add options contains_eager like
result = result.options(contains_eager(Comment.user))
Well no because you're digging way into RECURSIVE queries which SQLA
doesn't yet support very nicely. Mapping
:
On Oct 20, 2011, at 4:03 AM, Alex K wrote:
result2 = db.session.query(non_primary_mapper).from_statement('SELECT
test.id AS test_id, test.user_id AS test_user_id, test.reply_id AS
test_reply_id, test.text AS test_text FROM test LEFT OUTER JOIN user ON
user.id = test.user_id LIMIT 1 OFFSET
0
', content_comments_level_add)
and it works.
Thanks!
On Thu, Oct 20, 2011 at 6:54 PM, Michael Bayer mike...@zzzcomputing.comwrote:
On Oct 20, 2011, at 10:45 AM, Alex K wrote:
I solve this problem with new custom Query class:
it appears all you're doing is injecting an extra column
Hi All,
I need to construct the following query:
select ADDDATE(start,INTERVAL rt_daily_days DAY) from _event where
repeat_type = 1;
and I have difficulties in dealing with the following statement:
INTERVAL rt_daily_days DAY,
how can I do this using sqlalchemy func interfaces?
Hi All,
I need an advice, take a look at this code sample:
engine = create_engine(url,encoding = 'utf-8',echo = False,pool_size =
100)
metadata = MetaData()
object_table = Table('_object', metadata,
Column('id', Integer, primary_key=True),
DB is utf-8 encoded/collated etc.
On Mar 19, 1:22 pm, Noah Gift noah.g...@gmail.com wrote:
On Thu, Mar 19, 2009 at 11:20 PM, Andreas Jung li...@zopyx.com wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 19.03.2009 11:14 Uhr, Alex K wrote:
Well, it does not affect
Well, this error says that you have rows in other(or same) tables
referring to this row you are going to delete,
and you should delete referring rows first. If you want SQLA to do it
automatically,
you need to use sessions and mappers (not raw SQL expression engine),
more info here:
Patch works like a charm!
Thanks once again,
Alex
--~--~-~--~~~---~--~~
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,
Hi All!
Assume we have the following setup:
a_table = Table('A', metadata,
Column('id', Integer, primary_key=True)
)
b_table = Table('B', metadata,
Column('id', Integer, primary_key=True),
Column('parent_b1_id', Integer,
() for now.
On Jan 22, 2009, at 5:10 AM, Alex K wrote:
Hi All!
Assume we have the following setup:
a_table = Table('A', metadata,
Column('id', Integer, primary_key=True)
)
b_table = Table('B', metadata,
Column('id', Integer, primary_key
You can definitely access this table, using SQL engine only
my_table = Table('my_table', metadata,
Column('my_field', String)
)
#now we can perform the query
session.connection().execute(my_table.select())
#more info here:
Hello Michael,
JFYI - schema mapping approach worked fine, however I faced a new
requirement to clear mappings in case if schema was altered (since I
can not restart the web server),
so I will try to clear partial mappers as you've suggested,
Alex
On 29 сент, 18:35, Alex K [EMAIL PROTECTED
Hi All,
I get 'Mysql server has gone away' and 'failed to reconnect' errors,
that's why I think that my app holds connections and never releases
them.
But the irony is that I'm issuing rollbacks or commits at the end of
every request (rollbacks on any exception, commit if everything is ok)
and
in the
database.
Ants
On Oct 16, 12:56 pm, Alex K [EMAIL PROTECTED] wrote:
Hi All,
I wonder if there is a way to set what columns of the object will be
used during this particular query, to reduce the query in case if I
need the object, but I don't need all object properties
Hi All,
I wonder if there is a way to set what columns of the object will be
used during this particular query, to reduce the query in case if I
need the object, but I don't need all object properties.
is something like this: session.query(User).load('column_a') possible?
session.query([...])
That's fine, but I'd like to do the same for columns
On 16 окт, 13:50, [EMAIL PROTECTED] wrote:
for relations, u can put deferred(name) and noload(name) in
quety.options( ...).
no idea for plain columns
On Thursday 16 October 2008 12:56:19 Alex K wrote:
Hi All,
I wonder
Hi,
Seems that you need to call a function, here are the docs describing
how to do this:
http://www.sqlalchemy.org/docs/05/sqlexpression.html#sql_everythingelse_functions
Regards,
Alex
On Oct 2, 3:49 pm, Ye Xu [EMAIL PROTECTED] wrote:
Hello Everyone,
database table testArray
Column |
Hello, Ksenia,
This may help:
http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_relation_strategies_containseager
On Sep 29, 2:38 am, Ksenia [EMAIL PROTECTED] wrote:
Hi list,
I can't figure out a very simple thing. All I want is to do this
query:
select table1.A, table2.B,
Not sure about append, but you can definitely use column_property for
generated select property, more details here:
http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_mapper_expressions
Alex
On 29 сент, 16:03, Nick Murdoch [EMAIL PROTECTED] wrote:
Hi everyone,
I have an unusual
Hi All,
My application uses XML schema to load tables, classes, set SQLA
mapping and relations.
Each processing node (thread or process, depends on config) does not
know beforehand what type of mapping it will process, that's why I
need to create mapping (parse schema, and generate classes) per
Thanks for such a detailed response!
I'll try schema caching approach and will bring back the results,
Thanks again,
Alex
On 29 сент, 18:21, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 29, 2008, at 9:30 AM, Alex K wrote:
Hi All,
My application uses XML schema to load tables
Hi,
I was only able to achieve this via joins and eagerloads, so I would
be also interested in the relations based example
Alex
On 26 сент, 14:59, [EMAIL PROTECTED] wrote:
hi
say i have Person, Address, Street:
person has (many) addresess, address has (many) streets,
... could be more
Hi All,
I have created comparable property JoinedValues that represents any
joined columns, e.g. full name for first_name and last_name.
Everything works, fine, except the moment when I try to select this
property explicitly, e.g. like:
session.query(User.full_name)... i get error 'ClauseList'
Thanks, Michael.
I've just tried your example with column_property, everything works
fine, except one thing:
Does column_property hides the properties it relies on?
So, once I added full_name, last_name and first_name disappeared, is
it possible to have them existing along with full_name?
Sorry, I've re-checked, it was my typo, all properties co-exist ok,
Thanks again,
Alex
On 26 сент, 21:37, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 26, 2008, at 1:09 PM, Alex K wrote:
Thanks, Michael.
I've just tried your example with column_property, everything works
fine, except
OK, I'm back again. Played with Elixir and was able to re-implement
your example - got the query desired.
However I've found a couple of strange parts of your code.
1. Why do you mix mapper(), Table and Elixir? Elixir creates tables
and maps everything for you, this is what it was designed for.
Hi,
Try to replace
.join(Prosjekt,Sak.prosjektid) with the .join(Prosjekt,Sak.prosjekt)
in your first query and write back,
Alex
On 23 сент, 12:38, olavgg [EMAIL PROTECTED] wrote:
I've recently started using SQLAlchemy and is a newb. I have good SQL
knowledge though. My first project with
Pylons and SQLAlchemy!
On 23 Wrz, 12:16, Alex K [EMAIL PROTECTED] wrote:
Hello, here is the answer:
# -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, String, Unicode,
MetaData, ForeignKey
from sqlalchemy.orm import
K, seems that I've found the root cause:
When you are making the join from query, the syntax is:
app.session.query(Sak).join(Sak.prosjektid).filter(
where Sak.prosjektid is the relation property of the Sak class
or you can specify the target in the tuples form:
it be an issue with Elixir which I'm using? Or with Plone/Five?
What about just using a from_statement?
On Sep 24, 3:16 pm, Alex K [EMAIL PROTECTED] wrote:
K, seems that I've found the root cause:
When you are making the join from query, the syntax is:
app.session.query(Sak).join
And how can you do this via explicit SQL?
On 23 сент, 18:32, mraer [EMAIL PROTECTED] wrote:
Suppose I have two classes of objects which have a reference to each
other:
Class A:
b
Class B:
a
Both references are mandatory so nullable = False
I use post_update = True in relation function
Hello Matt, this should help:
you are using many-to-many relationship, (book_author_table - is your
association table)
please read this first:
http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_relation_patterns_manytomany
After what you can turn to
Hello,
What do you mean by real value? You've got 2 perfect Category
objects associatied with your Item,
mosst.model.page.Category object at 0x020F67B0 - is just a string
stamp of the object when converted to a string.
you may want something like this: item.categories[0].name to access
the name
40 matches
Mail list logo