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 wrote:
> I found a recipe on stackoverflow for turning a query instance into a
> string, including parameters.
Thanks!
Great work! :)
On Sat, Jan 21, 2012 at 3:18 AM, Conor 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 unique
> constraint
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')
quer
nullable=False, server_default='
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 wrote:
> On 11/11/2011 11
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 (user_i
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
> 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 sqlalchemy@g
pulate_instance', content_comments_level_add)
and it works.
Thanks!
On Thu, Oct 20, 2011 at 6:54 PM, Michael Bayer wrote:
>
> 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 injec
owerful! :)
On Thu, Oct 20, 2011 at 6:08 PM, Michael Bayer wrote:
>
> 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_repl
On Wed, Oct 19, 2011 at 7:57 PM, Michael Bayer wrote:
>
> > 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 to them is not a p
On Wed, Oct 19, 2011 at 7:57 PM, Michael Bayer wrote:
>
> On Oct 19, 2011, at 11:44 AM, lestat wrote:
>
> >
> > and use it:
> > hierarchy_mapper = HierarchyMapper(model_class, model_class.__table__,
> > non_primary=True)
> > result =
> > db.session.query(hierarchy_mapper).from_statement(hie_statem
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?
func.ADDATE(Eve
DB is utf-8 encoded/collated etc.
On Mar 19, 1:22 pm, Noah Gift wrote:
> On Thu, Mar 19, 2009 at 11:20 PM, Andreas Jung wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
>
> > On 19.03.2009 11:14 Uhr, Alex K wrote:
> > > Well, it does not affec
Well, it does not affect the performance and I still get:
Server Software:Apache/2.2.8
Server Hostname:localhost
Server Port:80
Document Path: /l
Document Length:87305 bytes
Concurrency Level: 100
Time taken for tests: 17.146102 seconds
Comple
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),
Column('_owner_id
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:
http://www.sq
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, se
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:
http://www.sqlalchemy.org/docs/05/sqlexpr
() 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)
> >
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, ForeignKey(
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 P
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 s
be None regardless of the value 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 reduc
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 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([...]) -
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
>
> Colu
Hi Guillaume,
The issue that you've faced looks strange - I've just tried to execute
your first example causing the error on my 5.0.45 mysql server and
tables were created ok. Can you post the code snippet causing the
error?
Regards,
Alex
On 1 окт, 16:59, GustaV <[EMAIL PROTECTED]> wrote:
> Hi
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,
>
>
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
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 unusu
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, table
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 exa
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?
Alex
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 " 'ClauseLis
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 l
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.
the time when I
> use .join()
> Could 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:
>
> > Whe
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:
app.session.query(Sak).join
er having 30 multiple relations, it will generate huge ammount
> of data M*n*x*...)
>
> On 23 Wrz, 16:37, g00fy <[EMAIL PROTECTED]> wrote:
>
> > Thnx a lot Alex! I already love Pylons and SQLAlchemy!
>
> > On 23 Wrz, 12:16, Alex K <[EMAIL PROTECTED]> wr
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 wit
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 relat
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 sessionmaker, mapper,
dynamic_loader,backref, relation, composite, comparable_property,
contain
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
http://www.sqlalchemy.org/docs/0
I've found this function that can probably help you
def clear_mappers()
Remove all mappers that have been created thus far.
The mapped classes will return to their initial "unmapped" state
and can be re-mapped with new mappers.
On Sep 10, 7:41 pm, [EMAIL PROTECTED] wrote:
> hi
> is there a
Hello,
What do you mean by "real value"? You've got 2 perfect Category
objects associatied with your Item,
- 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 of a particular category.
On Sep 10, 2:39 pm
That's certainly the root cause, since each thread has it's own
session in my config. Thanks!
Alex
On 5 сент, 21:59, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Sep 5, 2008, at 1:48 PM, Alex K wrote:
>
>
>
>
>
> > Hi All,
>
> > I'm usin
they don't work.
I've rewrote the code using regular mapper. If each thread maps the
class to the table. everything is ok,
Once I put the lock to make initialization only once per process, I
get this error.
I would appreciate any feedback from you,
Thanks in advance,
Alex K
--~--
47 matches
Mail list logo