On Tue, Jun 20, 2023 at 3:47 PM Mike Bayer
wrote:
>
>
> step 1 is stop using that silly Flask extension that gives you
> "Pipeline.query", I can't tell what it is you want to SELECT from either by
> reading this query.
Wow, that made things a lot easier.
Is there any reason to avoid mixing
I've been banging on this for hours, but I seem to be getting nowhere.
I've tried more things that I can count, but here are two of my attempts:
# result = (
#Pipeline.query
# .select_from(Storage, NewProduct)
# .join(Storage, pipeline_alias1.storage_id == Storage.id)
#
Hi.
In https://pajhome.org.uk/blog/10_reasons_to_love_sqlalchemy.html it says:
When performing highly complex queries, it is possible to define these
with SQLAlchemy syntax. However, I find there's a certain level of
complexity where it becomes easier to write SQL directly. In that
case, you can
Hi folks.
I have a subquery that is selected from a table with 5 foreign keys,
and joined with another table with 3 foreign keys.
And then that subquery is used in a join with the table having the 3
foreign keys again.
I don't know how to tell what column(s) that join is happening on.
What
I know, python2 is long dead. We’re almost ready for Python3, but not quite.
Anyway, here’s a traceback that I’m not sure what to make of. Is it
saying that a transaction got so big that it couldn’t be fully flushed
within the timeout window? I’ve elided a sensitive part from the very
end of
eliminate much of what the query is producing?
From: 'Dan Stromberg [External]' via sqlalchemy
Date: Tuesday, March 21, 2023 at 9:05 AM
To: sqlalchemy@googlegroups.com
Subject: Re: [sqlalchemy] Test query seems to spuriously give
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1054
Hoping to save an iteration: the SQL currently looks like:
[SQL: SELECT tb_nv.id, min(bs_3.build_id) AS min_1
FROM tb_nv, tb_brst AS bs_3, tb_brst AS bs INNER JOIN tb_vers AS v_2 ON
bs.version_id = v_2.id, tb_brst AS bs_2 INNER JOIN tb_br ON tb_br.id =
bs_2.branch_id]
From: 'Dan Stromberg
torial/data_select.html*explicit-from-clauses-and-joins__;Iw!!Ci6f514n9QsL8ck!gsSZYRslnIShc80D5SJP9hQv7FJkNL5Bzfvc8dkqobmEg8-ctkAcRyR1sZuv3pRL4eCzLvlJC-VDSf5sXXQNtX0d4POMpzTQh3-QUw$>
On Mon, Mar 20, 2023, at 5:16 PM, 'Dan Stromberg [External]' via sqlalchemy
wrote:
I’m getting some pushback int
Here’s the select, and most of the from clause:
select nv.id, min(bs.build_id) as min_build_id
from tb_v as v,
tb_nv as nv,
tb_bs as bs,
tb_br as br,
From: 'Dan Stromberg [External]' via sqlalchemy
Date: Monday, March 20, 2023 at 2:16 PM
To: sqlalchemy@googlegroups.com
Subject: Re
n Mon, Mar 20, 2023, at 10: 33
AM, 'Dan Stromberg [External]' via sqlalchemy wrote: That makes sense, but….
I’m afraid I don’t know how to add tb_br to the select. I tried: query = (
select(NV. id,
what SQL are you going for ? start with that.
On Mon, Mar 20, 2023, at 10:33 AM, 'Dan Stromberg
query to include some indication how tb_br is part
of what's being joined.
On Fri, Mar 17, 2023, at 7:52 PM, 'Dan Stromberg' via sqlalchemy wrote:
Hi people.
I'm having trouble with a test query.
As the subject line says, I'm getting:
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError
Sorry, I don’t know why Google Groups decided to aggregate a few lines into 2
large lines. Here’s that list of versions again. Hopefully GG will be
appeased this time.
I'm using:
$ python3 -m pip list -v | grep -i sqlalchemy
Flask-SQLAlchemy 2.5.1
Hi people.
I'm having trouble with a test query.
As the subject line says, I'm getting:
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1054, "Unknown
column 'tb_br.id' in 'on clause'")
But it seems like tb_br exists, and has an id column - tb_br being an empty
table, but still,
I'm trying to use UNIQUE on a column in a table, catching exception in
order to determine conflict.
Problem is that the exception I'm getting is sqlite3.IntegrityError. This
is not a SqlAlchemy exception, and its a problem since sqlite is temporary.
I expected to get a ORM/SA exception, that
This is almost but not quite what I want.
In your example, if the dictionary includes keys that do not map to object
fields, it will throw.
I want to try and 'cherry-pick' fields of the object from the dictionary.
With the introspect you gave me I can do that.
Thanks,
Dan
On Monday, January 28
ent to cat = Cat(alias = 'kitti)
>
> Load will pick field names that exist in the passed Object, and have a
> value in dict
>
> Thanks,
> Dan
>
>
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provi
lias = 'kitti)
Load will pick field names that exist in the passed Object, and have a
value in dict
Thanks,
Dan
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
It happens implicitly when iterating over the cursor to get the results.
Here's an example using fetchmany:
import psycopg2
from datetime import datetime
conn_str = 'host=redshift_host port=redshift_port username=username
password=password'
query = 'SELECT * FROM test WHERE timestamp > %s'
Yes, it is a select query. I tried to re-create this just using psycopg2
and named cursors and didn't get an error so I thought it had to be
somewhere in sqlalchemy
import psycopg2
from datetime import datetime
conn_str = 'host=redshift_host port=redshift_port username=username
Sorry, that code sample contained a typo. It should be:
from sqlalchemy import create_engine
engine = create_engine('postgres+psycopg2://username:password@
redshifthost:port/db_name')
with engine.connect().execution_options(stream_results=True) as conn:
results = conn.execute(query)
data
I've run into an issue with Redshift and I thought I would post it here
before logging a bug. If I run a query against a Redshift database table
that happens to return 0 rows I get an error when I try to iterate over the
result set. I run a pretty simple script that is looking for rows where
some_user_defined_function('2013-12-29',
NULL, '3', 638, NULL))
for row in cursor:
print row
and that did work.
So I have two questions.
1. Why can't I see my results from the select objects I am using?
2. How can I pass Default as a parameter to the function?
Thanks in advance
--Dan Clark
Nevermind about question 2. I really thought I was using parameters that
would return something. Apparently not. However, question 2 still remains.
--Dan
On Monday, December 30, 2013 7:12:04 PM UTC-5, Dan wrote:
Hello,
I have been trying to find the appropriate syntax to query from a user
(a, Widget.id==
a.c.widget_id).all()
My code is pretty rough but it works. Thanks again Michael.
--Dan
On Monday, December 30, 2013 7:36:40 PM UTC-5, Michael Bayer wrote:
On Dec 30, 2013, at 7:12 PM, Dan wpu@gmail.com javascript: wrote:
Hello,
I have been trying to find the appropriate
#sqlalchemy.orm.query.Query.filter_by
Docs are good but for the very lazy :)
filter_by(name = 'Dan') or filter(User.name == 'Dan')
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send
to make the above do-able? An explanation for
how to produce any kind of custom select statement (that could then be
selected from) would be fine. Or if this isn't possible currently please
let me know.
Thanks,
Dan
--
You received this message because you are subscribed to the Google Groups
to the
pesticide done.
I've looked at the Unique Object wiki, however I am not sure that solves my
issue. Is there a way that SQLAlchemy can handle this, or do I need to
manually build the entries in the PestToPesticide association table?
Thanks!
Dan
PestToPesticide = Table('pest_to_pesticide
is that rows in this table will be unique. if you are
appending duplicate entries to pestList or pesticide you may want to
use collection_class=set to maintain uniqueness in the collection.
On Apr 24, 2013, at 12:51 PM, dan d...@inlet.geol.sc.edu javascript:
wrote:
I've got a many to many
Cool, that's what I wanted to know. I didn't want to miss some function
that did this for me if it was there.
Thanks alot for the help!
Dan
On Wednesday, April 24, 2013 1:42:39 PM UTC-4, Michael Bayer wrote:
On Apr 24, 2013, at 1:38 PM, dan d...@inlet.geol.sc.edu javascript:
wrote
...@qnx.com.
Will welcome remote workers.
Thanks,
Dan
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/4NPzACxaypsJ.
To post to this group, send email to sqlalchemy
the relationship list without actually replacing
the list instance? Then we wouldn't need to worry about whether we are
accidentally holding onto references to expired lists which have been
replaced out from underneath us.
Is there some other way we could avoid this kind of problem?
--
Dan
Dear List,
Hoping for help with following unanswered stackoverflow question. If the
approach is not the best, that feedback is good as well.
In the case below is it better to just not use relationships and just use
the method with the query?
Thanks
cast it to a string, getattr returns the data that I
wanted.
Is there a better way to do what I'm trying to do, or is this a bug in
the code?
Thanks,
Dan
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy
__table__, and also shouldn't be required at all since auto-correlation is
sufficient here.
On Mar 28, 2011, at 12:23 PM, dan wrote:
Thanks for the feedback. I found an example in google groups that got
me on the right track.
For those interested, my sqlalchemy looks like
Thanks for the feedback. I found an example in google groups that got
me on the right track.
For those interested, my sqlalchemy looks like:
multi_obs2 = aliased(multi_obs)
subQ = qaqc.db.session.query(multi_obs2).\
filter(multi_obs2.m_date =
(matchDatesQ)).\
order_by(multi_obs.m_date.asc()).all()
however, I get errors in the matchesDateQ query about the mo not
being defined. I understand why that is, I just am not sure how to go
about getting this to work.
Any tips/hints are greatly appreciated.
Dan
--
You received
I'd like to find some way to implement access controls on mapped
objects, with the following features:
* Example: given a BlogPost object, only the owner, or a superuser,
would be allowed to set fields such as title and body.
* Example: reading the body field would check the privacy field as
well
On Nov 22, 11:15 am, Michael Bayer mike...@zzzcomputing.com wrote:
I'm assuming the reason for proxy objects is so that usage would continue
to look like:
blogpost.body = new body
Right, exactly.
So for that kind of thing, if you want certain operations to proceed under
the
Thanks for those tips. InstrumentationManager sounded like the best
thing, so I've gone with that idea. Here's the basic structure of it
for anyone who's interested: http://pastie.textmate.org/1318179
Thanks again, Michael.
--
You received this message because you are subscribed to the Google
guess there is a lot of data comming in ...
Thanks in advance,
Dan
--
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
(credits.c.billing_code, 3, 25) ==
Reseller.resellerid)
Any suggestions to make this happen?
--Dan
--
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
I have created a custom type in order to store denormalized PKs in a
TEXT field. The idea is that the text is converted back and forth from
a set of integers:
http://paste.pocoo.org/show/249784/
This seems to work OK, however if you make a change to the set it's
not picked up by SQLAlchemy on
On Aug 13, 3:17 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Aug 13, 2010, at 10:01 AM, Dan wrote:
I have created a custom type in order to store denormalized PKs in a
TEXT field. The idea is that the text is converted back and forth from
a set of integers:
http
Unfortunately still getting the same result:
http://paste.pocoo.org/show/249801/
The test snippet shows that the modified set is not actually saved to
the database.
On Aug 13, 3:29 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Aug 13, 2010, at 10:24 AM, Dan wrote:
On Aug 13, 3:17
that code snippet is not complete (doesn't create a Session, doesn't add Post
to it, doesn't commit() or flush() the session but then removes it so I guess
maybe its a scoped_session, don't know) so I don't actually know what you're
doing. The test case below adds your assertion, uses
The issue appeared to be removing the session instance
(session.remove()) - I was trying to get a clean session for testing.
Anyway, works fine now - thanks for your help and sorry for wasting
your time.
On Aug 13, 4:21 pm, Dan danjac...@gmail.com wrote:
that code snippet is not complete
? Are there any drawbacks to
sqlalchemy? Are there any other big orm projects for python, which one
should have a look at?
Sorry for asking this kind of general questions. But im looking for
some decission hints ...
Dan
--
You received this message because you are subscribed to the Google Groups
On May 26, 2:17 pm, Michael Bayer mike...@zzzcomputing.com wrote:
its in the identity map after the flush succeeds, which is well before
after_commit() is called.
That sounds reasonable, but I have debug output from after_attach,
before_flush, after_flush, before_commit and after_commit,
Thanks for your help. I'm not exactly sure what happened, so I'll have
to carefully look over this area again, but part of it was definitely
to do with needing the distinct session. Here's the minimal example I
extracted: http://pastie.textmate.org/private/lpgkq7gkaypmgkphknr2w
Frustratingly, the
I've only found partial answers to this problem so far, so I'd like to
expand on it here.
I have a site in which users post stories, and their friends are
notified. In order to decouple different parts of the business logic,
I would like to use a publish/subscribe mechanism that raises an event
On May 26, 9:43 am, Michael Bayer mike...@zzzcomputing.com wrote:
You can expire the attribute manually ahead of time if you want it to reload
its value (should be fine within after_commit).
No, it seems that in after_commit the newly added instance is not yet
in session.identity_map, so
, Dan Kuebrich wrote:
My apologies; I expressed my question rather incoherently.
if the question is, I want to multiple insert like [{'a':1, 'b':2, 'c':3},
{'a':2}, {'a':3, 'b':4}], etc. only some dictionaries are missing different
keys, that is not allowed. The structure of the SQL
I found a similar thread from about a year ago (http://
groups.google.com/group/sqlalchemy/browse_thread/thread/
66ef04fd10fd2be/ec7784b70abedabe), but it never seemed to answer the
most burning question: is there a way in sqlalchemy to do a multiple
insert with default values for unspecified
My apologies; I expressed my question rather incoherently.
if the question is, I want to multiple insert like [{'a':1, 'b':2, 'c':3},
{'a':2}, {'a':3, 'b':4}], etc. only some dictionaries are missing different
keys, that is not allowed. The structure of the SQL statement as parsed by
MySQL
I am having some problems using this approach. How should I use the
class STAsText in the GisElement.wkt property (example below)?
My current attempts are not working... it seems that the correct
statement is generated SELECT :param_1.STAsText(), but the Geography
instance is not being passed as a
That fixed it :)
and thank you Michael for your quick response to my questions.
--
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
Thank you Michael, that really helped a lot.
--
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...@googlegroups.com.
Thanks much! I couldn't find where that module is buried inside the
documentation, hence my question.
Best Regards,
Dan Presley
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post
Using sqlalchemy version 0.5.2, I've noticed that the sum method
seems to have been removed from Query :
session.query(MyClass).sum(MyClass.price)
'Query' object has no attribute 'sum'
I can't find this change documented anywhere : it was present in 0.4
as I recall.
Any reason for this ?
That worked great, thanks for your help.
2009/6/23 Michael Bayer mike...@zzzcomputing.com:
Dan wrote:
Using sqlalchemy version 0.5.2, I've noticed that the sum method
seems to have been removed from Query :
session.query(MyClass).sum(MyClass.price)
'Query' object has no attribute 'sum
querying for? Why don't you just keep a list of
all the instances you've already loaded?
2009/3/25 Dan F danielfal...@gmail.com:
I understand what get() is supposed to do, but it doesn't clear it up
because it still seems like there should be a way of retrieving a
*set* of records back from
it won't. Maybe it's in the docs.
Hope that cleared things up.
Regards,
Christian
2009/3/23 Dan F danielfal...@gmail.com:
Hi,
Is there a difference between using query.get(ident) and using
query.filter(MyClass.id.in_())? Specifically with regard to how the
mapper is used? If I'm
in IronPython, but beats me as to
where it's happening. You should try running it under the debugger.
-Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email
Not sure how to do it otherwise. This is how its been coded -- what
is the alternative?
On May 9, 8:34 am, Michael Bayer [EMAIL PROTECTED] wrote:
On May 9, 2008, at 4:26 AM, Dan wrote:
Using cx_Oracle, the following does the trick (note this is a
contrived example):
def test
quoted column name.
Any ideas how to work around this without changing the underlying
table definition in Oracle?
Thanks,
Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group
, function,
package, or type is not allowed here
'SELECT * FROM aaa_test' {}
How can I rework this?
Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy
modification?
Using sqlalchemy 0.4 beta 5, python 2.5, sqllite.
dl has a many-to-many relationship associated with it.
Any ideas why this is happening?
Thanks,
-Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
On 10/1/07, Michael Bayer [EMAIL PROTECTED] wrote:
most likely too many association rows are present in the m2m table.
Do you mean there were redundant associations? How can I check if
that's the cause of the problem?
Thanks,
-Dan
--~--~-~--~~~---~--~~
You
, but it would probably require some significant work, since
you'd have to transform SELECT statements into FETCH statements.
anyway, thanks for the fix!
On Sep 26, 8:01 pm, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 26, 2007, at 5:31 PM, Dan Watson wrote:
cursor.description isn't available after
in res:
print row
This results in a InterfaceError: cursor already closed exception
when iterating over the resultproxy.
Any ideas?
Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post
, and leave the SS cursor positioned
before the first row.
On Sep 26, 4:34 pm, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 26, 2007, at 3:52 PM, Dan Watson wrote:
It seems that something changed in 0.4 that causes server-side cursors
(in postgresql) to fail. I'm issuing the DECLARE/FETCH
the errors I assumed it must not.
Sorry for the false alarm,
-Dan
--~--~-~--~~~---~--~~
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
Right now, importing sqlalchemy on python 2.3 is broken. __name__ is
readonly in 2.3, so the import fails:
from sqlalchemy import *
Traceback (most recent call last):
File stdin, line 1, in ?
File /home/watsond/python_packages/sqlalchemy/__init__.py, line 9,
in ?
from sqlalchemy.schema
thanks!
On 3/6/07, Jonathan Ellis [EMAIL PROTECTED] wrote:
try
db.books.select(db.books.c.book_skus.like('abcd%'))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group,
an error, so obviously not. Pointers?
tia,
dan
--~--~-~--~~~---~--~~
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
75 matches
Mail list logo