Hi,
I posted
http://stackoverflow.com/questions/9729175/multidimensional-arrays-in-sqlalchemy
to StackOverflow. Reproduced below. Please CC me on any reply. Thanks.
Regards, Faheem
Hi,
See
http://stackoverflow.com/questions/8785899/hang-in-python-script-using-sqlalchemy-and-multiprocessing
particularly sbt's answer (http://stackoverflow.com/a/8795763/350713), and
also the Python bug reports http://bugs.python.org/issue13751 and
http://bugs.python.org/issue1692335.
[This message has also been posted.]
On Fri, 20 May 2011 09:44:36 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
OK so not just schema names, table structure as well. So yeah so
you're using the same classes among entirely different databases
essentially, so yeah just like our tests
On Fri, 20 May 2011 00:52:28 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On May 19, 2011, at 5:24 PM, Faheem Mitha wrote:
Unfortunately, that is not true. (So I guess just leaving the
structure alone and switching dbs will not work.) There are 4
possible different database layouts
an
UnmappedClassError. This at least doesn't return an error in my test
script, but I haven't checked if it actually works. Comments?
On Mon, 18 Oct 2010 13:06:01 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On Oct 18, 2010, at 5:36 AM, Faheem Mitha wrote:
Hi,
I should say in advance that I
Hi Michael,
Thanks for the reply.
On Thu, 19 May 2011 10:59:18 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
I'm sure I mentioned earlier, one of the reasons you're finding this
difficult is because of this type of pattern, where you're calling
mapper() and Table at a different scope
Hi Michael,
On Thu, 19 May 2011 16:13:49 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
Dont wipe anything clean - keep the state of each set of stuff
separate. A global dictionary perhaps, with an record inside for
each configuration.
Could you elaborate on what you have in mind?
On Thu, 19 May 2011 16:57:14 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On May 19, 2011, at 4:48 PM, Faheem Mitha wrote:
Hi Michael,
On Thu, 19 May 2011 16:13:49 -0400, Michael Bayer
mike...@zzzcomputing.com wrote:
Dont wipe anything clean - keep the state of each set of stuff
Hi,
I should say in advance that I don't have a reproduction script for this,
though I could probably manufacture one if necessary.
I have a python script which calls a function repeatedly. Each time the
function is called, it creates a bunch of SQLA tables, classes and mappers
between
Hi,
The following session is never saved to the db, not even a schema is
created, but a query returns correctly. I assume that there is local
caching going on. but session.dirty etc doesn't show anything. So, two
questions:
First, how (if possible) can I force sqla to hit the db? In this
Hi,
I'm using scoped_session with PostgreSQL to run multiple threads, each
thread creating a table. However, I'm getting some pretty weird and
inconsistent errors (segfaults from Python with some very peculiar
errors), and I was wondering if my usage was at fault.
The program has a serial
to the queue
self.queue.put((func, args, kargs))
def start(self):
for w in self.workerlist:
w.start()
def wait_completion(self):
Wait for completion of all the tasks in the queue
self.queue.join()
On Thu, 12 Aug 2010, Faheem Mitha wrote:
Hi
to a ThreadLocalMetaData. Would it better to use that instead?
Regards, Faheem.
On Thu, 12 Aug 2010, Faheem Mitha wrote:
Addendum: the types of error I'm seeing includes SQLA trying to execute
notices from the PG server eg. one of the tracebacks I'm
On Thu, 12 Aug 2010 08:47:33 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On Aug 12, 2010, at 5:10 AM, Faheem Mitha wrote:
Hi,
I'm using scoped_session with PostgreSQL to run multiple threads, each
thread creating a table.
Its generally a poor application practice
On Thu, 12 Aug 2010 09:44:04 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On Aug 12, 2010, at 9:25 AM, Faheem Mitha wrote:
Hi Mike,
Thanks for the response, but I don't follow.
When you say multiple threads are hitting the session you have
above, which session are you
On Thu, 12 Aug 2010 09:44:04 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On Aug 12, 2010, at 9:25 AM, Faheem Mitha wrote:
Hi Mike,
Thanks for the response, but I don't follow.
When you say multiple threads are hitting the session you have
above, which session are you
[This message has also been posted.]
On Thu, 12 Aug 2010 12:47:37 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On Aug 12, 2010, at 11:47 AM, Faheem Mitha wrote:
On Thu, 12 Aug 2010 09:44:04 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On Aug 12, 2010, at 9:25 AM, Faheem
On Thu, 29 Jul 2010 11:36:43 +0100, King Simon-NFHD78 simon.k...@motorola.com
wrote:
You can tell meta.create_all() to use the same underlying DB connection
as the session by using the session.connection() method with the 'bind'
parameter to create_all().
Ie.
connection =
Hi,
When calling create_all on a metadata instance after a session has alrady
been opened causes the create_all to hang, I assume because the session is
blocking the create_all. Is there some way to get create_all to use the
existing session, or any other graceful way around this? Thanks.
On Wed, 28 Jul 2010 15:17:09 +0530 (IST), Faheem Mitha fah...@email.unc.edu
wrote:
Hi,
When calling create_all on a metadata instance after a session has
alrady been opened causes the create_all to hang, I assume because
the session is blocking the create_all. Is there some way to get
Hi Lance,
On Wed, 28 Jul 2010 06:45:30 -0500, Lance Edgar lance.ed...@gmail.com wrote:
--=-dKyzuPx4woj1H0B5IT48
Content-Type: text/plain; charset=ISO-8859-1
On Wed, 2010-07-28 at 11:33 +, Faheem Mitha wrote:
On Wed, 28 Jul 2010 15:17:09 +0530 (IST), Faheem Mitha
fah...@email.unc.edu
Hi,
In the following script, the last line, namely
session.execute(select * from drop_constraint_if_exists('foo', 'foo_pkey',
'public');)
doesn't drop the constraint. It does if autocommit is turned off, and a
session.commit() is issued after the statement.
The autocommit setting works
Hi Mike,
On Tue, 27 Jul 2010 09:07:15 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On Jul 27, 2010, at 1:34 AM, Faheem Mitha wrote:
My usage is slightly non-standard - a foreign key pointing to a
foreign key.
that never worked, most likely. its very complicated to get the
types
Dear SQLAlchemists,
With the following script, I get the traceback below. This is not the
actual example I ran into, but a small test case. To my surprise, I was
able to reproduce the identical error almost immediately. In my actual
code, I was able to work around this error by doing a
.
Regards, Faheem.
On Tue, 27 Jul 2010, Faheem Mitha wrote:
Dear SQLAlchemists,
With the following script, I get the traceback below. This is not the actual
example I ran into, but a small test case. To my surprise, I was able to
reproduce the identical error almost immediately
Update:
On Tue, 27 Jul 2010, Faheem Mitha wrote:
Hi,
It turns out my example was too hasty. I should have had something like
foobar = Table(
'foo', meta,
Column('id', Integer, nullable=False, primary_key=True),
)
bar = Table(
'bar', meta,
Column('id', None, ForeignKey
[This message has also been posted.]
Hi Lance,
Thanks for the quick reply.
On Mon, 26 Jul 2010 17:09:06 -0500, Lance Edgar lance.ed...@gmail.com wrote:
I had a similar question a little while back and here was the answer:
[This message has also been posted.]
See followup comment below...
On Sat, 15 May 2010 07:44:04 -0700 (PDT), Michael Bayer
mike...@zzzcomputing.com wrote:
On May 15, 2:52 am, Faheem Mitha fah...@email.unc.edu wrote:
Hi,
I was trying to figure out a way to close all connections to a db
On Sun, 13 Jun 2010 11:20:58 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
When an exception occurs in a transaction while Postgresql, you in
most cases must issue a rollback() (that is what (InternalError)
current transaction is aborted, commands ignored until end of
transaction
, but it didn't
help.
Regards, Faheem.
On Jun 12, 2010, at 3:30 PM, Faheem Mitha wrote:
Hi,
While rearranging some Python code using SQLAlchemy, I managed to
get this puzzling error. The oddest bit is that using conn.execute
works, while
On Sun, 13 Jun 2010 13:33:39 +0530, Faheem Mitha fah...@email.unc.edu wrote:
I'm going to assume comment 1 and comment 2 are unrelated. If they
aren't, please correct me.
As regards 1, I assume you mean try... pass... is a bad idea. I agree,
but there is no
CREATE LANGUAGE IF EXISTS
[This message has also been posted.]
On Sun, 13 Jun 2010 13:27:34 -0700, Henry Precheur he...@precheur.org wrote:
I'm starting a new project which is roughly hosting a bunch of sites. I
want the sites to be isolated, they'll all have the same schema (data
definition), but will store their data
Hi,
While rearranging some Python code using SQLAlchemy, I managed to get this
puzzling error. The oddest bit is that using conn.execute works, while
session.connect doesn't.
Below, the code that doesn't work, the code that works, and last, the
traceback for the code that doesn't work. If
Hi,
Is there a more elegant way of getting a list of attributes corresponding
to a list of objects than the code below? Thanks.
Suppose Foo() is a object with attribute bar...
Regards, Faheem.
dbstring = ...
from dbschema import Foo
Hi,
I was trying to figure out a way to close all connections to a db.
Apparently
db = create_engine(dbstring)
conn = db.connect()
[...]
conn.close()
doesn't actually close the connection initiated by conn. I have to call
db.dispose()
which seems to do so, though I cannot find any clear
Hi,
In
http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#creating-engines
it describes how permitted urls are of the form
dialect://user:passw...@host/dbname[?key=value..],
I'm using postgresql. I believe sqlalchemy uses psycopg2 by default.
I've been connecting using
On Thu, 13 May 2010 09:25:21 -0400, Michael Bayer mike...@zzzcomputing.com
wrote:
On May 13, 2010, at 7:33 AM, Faheem Mitha wrote:
Hi,
In
http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#creating-engines
it describes how permitted urls are of the form
On Fri, 12 Feb 2010 13:33:01 +0100, Alex Brasetvik a...@brasetvik.com wrote:
On Feb 11, 2010, at 18:58 , Faheem Mitha wrote:
sqlalchemy forks a process when it calls the db
No, it does not.
PostgreSQL forks a new backend process when a connection is
established, however. It sounds like
On Thu, 11 Feb 2010 13:06:03 -0500, Michael Bayer
mike...@zzzcomputing.com wrote:
Faheem Mitha wrote:
Hi,
sqlalchemy forks a process when it calls the db (in my case PostgreSQL,
but I don't think it matters) using, for example
from sqlalchemy.sql import text
s = text(...)
um, what
On Fri, 12 Feb 2010 11:01:23 -0500, Michael Bayer
mike...@zzzcomputing.com wrote:
you would connect:
conn = engine.connect()
check the PID:
pid = conn.execute(SELECT pg_backend_pid()).scalar()
then continue as needed:
conn.execute(text(...))
Thanks, Michael. That's very clear and
Hi,
sqlalchemy forks a process when it calls the db (in my case PostgreSQL,
but I don't think it matters) using, for example
from sqlalchemy.sql import text
s = text(...)
My question - is it possible to obtain the pid of this process at the
python level in some fashion? The reason for this
()
function doesn't appear to have an 'autocommit' option. What can I do
to have a autocommit happen in this case?
Regards, Faheem.
On Wed, 7 Oct 2009 17:37:51 -0400 (EDT), Faheem Mitha
fah...@email.unc.edu wrote:
Hi,
When running
On Sun, 24 Jan 2010 09:27:26 -0500, Michael Bayer
mike...@zzzcomputing.com wrote:
On Jan 24, 2010, at 7:22 AM, Faheem Mitha wrote:
I'm belatedly following up to this earlier posting.
The problem there was that I wasn't setting autocommit=True in
text(). However, I was wondering what I can
On Fri, 9 Oct 2009 22:34:11 -0400, Michael Bayer
mike...@zzzcomputing.com wrote:
On Oct 9, 2009, at 7:35 PM, Faheem Mitha wrote:
Can you explain why removing the SET search_path TO public; string
makes a commit happen? You also say that string you have will not
trip off SQLA's autocommit
information_schema | postgres
pg_catalog | postgres
pg_toast | postgres
pg_toast_temp_1| postgres
public | postgres
(6 rows)
On Wed, 7 Oct 2009, Faheem Mitha wrote:
Hi,
When running this function with postgresql 8.4 and sqla 0.5.5,
def test(dbstring):
from
?
Regards, Faheem.
Faheem Mitha wrote:
Confirmed by Alex Grönholm on #postgresql on freenode with pg 8.3 and sqla
0.5.6. If this is not a bug, i'd like to know what is going on. Typing the
text in gq directly into psql (all on one line) produces the schema foo as
expected
Hi,
When running this function with postgresql 8.4 and sqla 0.5.5,
def test(dbstring):
from sqlalchemy import create_engine
db = create_engine(dbstring)
conn = db.connect()
from sqlalchemy.sql import text
gq = text(
SET search_path TO public;
DROP SCHEMA IF EXISTS
On Fri, 21 Aug 2009, King Simon-NFHD78 wrote:
I've never used postgres, but I believe auto-incrementing counters are
implemented using database sequences. I think these are incremented
outside of a transaction - this ensures that two seperate database
connections using the sequence at
Hi Simon,
On Fri, 21 Aug 2009, King Simon-NFHD78 wrote:
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
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 where is this table living, if not
Hi,
Today I attempted to serialize the return value of the form
result = conn.execute(text())
Till now I thought that the return type was a list of tuples, while in
fact it is a list of objects of type class
'sqlalchemy.engine.base.RowProxy'. Hence cPickle refused to serialize
till I did
[This message has also been posted.]
On Wed, 28 Jan 2009 01:28:31 +0200, a...@svilendobrev.com
a...@svilendobrev.com wrote:
i have recently stumbled on similar - the rowproxy's __hash__ was
missing. so i have to tuple() them before usage. Then there was
Mike's question, what should the
On Wed, 21 Jan 2009 10:55:14 -, King Simon-NFHD78
simon.k...@motorola.com wrote:
-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
On Wed, 21 Jan 2009 08:26:13 -0800, jason kirtland
j...@discorporate.us wrote:
Faheem Mitha wrote:
Hi,
I've got a query as follows:
from sqlalchemy.sql import text
gq = text(
SELECT decode_genotype(cell.snpval_id, snp.allelea_id,
snp.alleleb_id) FROM cell JOIN snp ON snp.fid
Hi,
I've got a query as follows:
from sqlalchemy.sql import text
gq = text(
SELECT decode_genotype(cell.snpval_id, snp.allelea_id,
snp.alleleb_id) FROM cell JOIN snp ON snp.fid =
cell.snp_id WHERE cell.patient_chipid IN ('DUKE1_plateA_A10.CEL',
'DUKE1_plateA_A11.CEL')
)
I want
()
*
value of result is [(2,), (1,), (-1,), (1,), (1,), (-1,)...]
Please CC me on any reply. Thanks.
Regards, Faheem Mitha.
--~--~-~--~~~---~--~~
You received this message because
On Thu, 15 Jan 2009, Matthew Zwier wrote:
Hi Faheem,
On Thu, Jan 15, 2009 at 11:05 AM, Faheem Mitha fah...@email.unc.edu wrote:
Hi,
The following code returns a list of tuples to python from the db,
corresponding to the values of the 'snpval_id' column in the table 'cell'.
I
.
Executing bugfn directly in psql works fine, so it is not a postgres
problem.
Traceback follows. If I need to submit an issue, let me know. Please cc me
on any reply.
Regards, Faheem Mitha
[This message has also been posted.]
On Tue, 30 Dec 2008 23:51:23 -0500, Michael Bayer
mike...@zzzcomputing.com wrote:
try escaping your percent signs: %%. otherwise they appear to
psycopg2 like bind parameters. The exception is raised by psycopg2.
Oh, I see. Thanks for the information.
Hi,
I'm writing code (see below) to drop and add back foreign key constraints
to a db table. Incidentally, this code is not working (the function just
hangs) so I may have made some kind of syntax error. Anyway, I was
wondering if there was some way to accomplish this in a more high-level
On Fri, 19 Dec 2008 15:10:07 -0500, Michael Bayer
mike...@zzzcomputing.com wrote:
On Dec 19, 2008, at 2:43 PM, Faheem Mitha wrote:
I'm writing code (see below) to drop and add back foreign key
constraints to a db table. Incidentally, this code is not working
(the function just hangs) so I
On Fri, 5 Dec 2008, Faheem Mitha wrote:
Hi,
I'm using sqla with the following schema (see below). I'm creating a cell
object implicitly, using the function make_cell and the association proxy
pattern.
def make_cell(patient_obj, snp_obj, snpval):
patient_obj.snps[snp_obj] = snpval
On Fri, 5 Dec 2008, King Simon-NFHD78 wrote:
You can get the mapper for a given instance using the
sqlalchemy.orm.object_mapper function, and that mapper has a
'primary_key_from_instance' method. A generic primary_key function might
look like this (untested):
import sqlalchemy.orm as orm
Hi,
I'm using sqla with the following schema (see below). I'm creating a cell
object implicitly, using the function make_cell and the association proxy
pattern.
def make_cell(patient_obj, snp_obj, snpval):
patient_obj.snps[snp_obj] = snpval
return patient_obj
My question is, is
Hi,
I'm trying to figure out how to have an object return its primary key
without knowing what it is called. The docs in
http://www.sqlalchemy.org/docs/05/sqlalchemy_orm_mapper.html look
relevant, for example the function identity_key_from_instance (see entry
from docs below), but I'm not
On Wed, 3 Dec 2008 08:58:42 -0500 (EST), [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
On Tue, 2 Dec 2008 at 23:21, Faheem Mitha wrote:
Yes, I was looking for this, and printed out obj.__dict__ but didn't
see it there. A dictionary of attributes is very useful in theory, but
doesn't always seem
Hi,
If I have an ORM object, it is sometimes convenient to be able to infer
the class directly. Eg. consider this function.
def add_patient_obj(session, patient_obj):
Check if object primary key exists in db. If so,exit, else
add.
pid = patient_obj.id
#print
[This message has also been posted.]
Hi Eric,
Thanks very much for the improvement.
On Tue, 2 Dec 2008 15:04:34 -0800 (PST), Eric Ongerth
[EMAIL PROTECTED] wrote:
def add_obj(session, obj):
Check if object primary key exists in db. If so,exit, else
add.
pid = obj.id
[This message has also been posted.]
On Tue, 2 Dec 2008 18:25:19 -0500, Michael Bayer
[EMAIL PROTECTED] wrote:
On Dec 2, 2008, at 6:04 PM, Eric Ongerth wrote:
[snip]
Furthermore, if you really need to determine the object's class's
mapped table,
obj_table =
On Mon, 17 Nov 2008, Faheem Mitha wrote:
Hi,
I've written a session transcript to init db tables and add objects
(well, rows) to the tables. The issue I'm currently facing is how to
make the creating and populating the tables section of the script a
no-op when the objects exist
Hi,
[I was told on IRC this was not worth bothering with, but since I've
already written it, I'm sending this out. Please ignore if useless.]
I mistakenly did
query = session.query(Patient).filter_by(id==John).all()
and got the curious response:
TypeError: filter_by() takes exactly 1
Hi,
I've written a session transcript to init db tables and add objects (well,
rows) to the tables. The issue I'm currently facing is how to make the
creating and populating the tables section of the script a no-op when
the objects exist. If the tables already exist sqlalchemy does nothing,
On Wed, 12 Nov 2008, Michael Bayer wrote:
On Nov 12, 2008, at 3:31 PM, Faheem Mitha wrote:
2) In section Building Complex Views
print broker.holdings[stock].shares
# 10
Isn't holdings[stock] the share value? Ie. shouldn't this just be
print broker.holdings[stock]
?
im going
On Thu, 13 Nov 2008, Faheem Mitha wrote:
On Wed, 12 Nov 2008, Michael Bayer wrote:
On Nov 12, 2008, at 3:31 PM, Faheem Mitha wrote:
4) A more general question:
I'm having difficulty parsing the last three lines in the itemized list in
Section associationproxy.
The relation
Hello everyone,
A few minor issues with association_proxy, especially wrt the
association object pattern.
The following points reference
http://www.sqlalchemy.org/docs/05/plugins.html
1) First, a typo. In section Simplifying Association Object
Relations: Because the proxies are backed a
Hi,
I've got some genome data, and I'm trying to move it into a db.
The data looks like
Patient FOOSNPBARSNP ...
Tom AA AT
John AT AA
...
These columns correspond to SNPS
76 matches
Mail list logo