I have a number of database that have the same tables in them.
I create a session for 1 data and do some work. This work causes
a number of table table object to be reflected from the database
and then mapped. This works fine.
Now I Switch to another database which has the same tables. If I
acces
Hi Lele !!
You were faster than me... :)
I tested your patch and it run fine here...
Thanks !!!
Roger
On 10/6/06, Lele Gaifax <[EMAIL PROTECTED]> wrote:
> Michael Bayer wrote:
> > any dropping of "AS" for alisases has to occur locally within the
> > firebird dialect;
>
> That's of course wha
Michael Bayer wrote:
any dropping of "AS" for alisases has to occur locally within the
firebird dialect;
That's of course what I meant.
feel free to send a patch. I have no test instance of firebird here
I'm attaching two patches, one that enables the test frameword for
firebird, and one
Hi Ezio,
I am not sure if I can switch firebird's version... My client has a
system build with Delphi 7 & BDE .. and we would have to re-test all
this system with Firebird 2... :(
I took a quick look at SA source code. If I am not wrong, all I have
to do is override "visit_alias" method in FBCom
any dropping of "AS" for alisases has to occur locally within the
firebird dialect; most other databases require it. you can add an
overridden "visit_alias()" method in firebird's FBCompiler (the base
method is in ansisql.py) to achieve this. (feel free to send a
patch. I have no test ins
Ezio Vernacotola wrote:
> A possible workaround is switch to firebird 2.0 now, is very close to
> final release, largely backward compatible and accepts "AS" in table
> aliasing
Unfortunately it's not an easy switch, so I gently insist SA should drop
the "AS" keyword usage, even from the column
A possible workaround is switch to firebird 2.0 now, is very close to
final release, largely backward compatible and accepts "AS" in table
aliasing
Ezio
Roger Demetrescu wrote:
Yes... I don't have SA here now, but probably the example from [1]
won't work either.
I'll try it tomorrow mornin
Yes... I don't have SA here now, but probably the example from [1]
won't work either.
I'll try it tomorrow morning and let you know
Cheers,
Roger
[1] - http://www.sqlalchemy.org/docs/sqlconstruction.myt#sql_alias
On 10/5/06, Lele Gaifax <[EMAIL PROTECTED]> wrote:
> Ezio Vernacotola wrot
Hi Ezio,
I have the following code:
8<
duplicata_table = Table('DUPLICATA', metadata,
Column('dpl_loja', String(2), primary_key=True),
Column('dpl_id', Integer, Sequence('GEN_DPL_ID'), primary_key=True),
Column('dpl_ticket', Integer),
Column('dp
Ezio Vernacotola wrote:
> I don't understand what you are trying do to with column and table aliasing.
> Can you give some code example to better explain your problem?
>
I think it is not relevant: effectively Firebird does not like the table
alias introduced by "AS", so most probably the FB bac
I don't understand what you are trying do to with column and table aliasing.
Can you give some code example to better explain your problem?
Ezio
Roger Demetrescu wrote:
> Hi,
>
> Firebird 1.5 allows the following sentences:
>
> select myfield from mytable;
> select myfield FOO from my table;
Hello,I'm having some issues when I try to put an identically named bind parameter into two selects, and then union them.from sqlalchemy import *meta = DynamicMetaData()# I have these two tables:
users = Table('users', meta, Column('id', Integer, primary_key = True), Column('user_name', S
Hi,
Firebird 1.5 allows the following sentences:
select myfield from mytable;
select myfield FOO from my table;
select myfield AS FOO from mytable;
(the last 2 sentences change the name of the final column, right ?)
The same rules don't apply when we create tables aliases:
select myfield from
I think this may partly illustrate the problem (or am I doing something
silly?):
CREATE SCHEMA content;
CREATE SEQUENCE content.node_id_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
CREATE TABLE content.node
(
id int8 NOT NULL DEFAULT nextval('content.node_i
yes yes, i still want to put your pg_schema patch in...just been
procrastinating...also i think it needs adjustment for the new
ForeignKeyConstraint object. (maybe you can try it out agaisnt the
latest trunk and see if it still works / adjust as necessary) ?
was just curious about current
> If using autoload=True when defining your metadata, be sure your FK
> constraint names are unique to the schema . PostgreSQL scopes FK
> constraint names to the table, but SQLAlchemy loads them from the SQL
> standard information_schema, which is designed for schema-scoped
> constraint na
I just noticed this comment thats been sitting on the wiki for a few
months:
If using autoload=True when defining your metadata, be sure your FK
constraint names are unique to the schema . PostgreSQL scopes FK
constraint names to the table, but SQLAlchemy loads them from the SQL
standard i
youre only allowed to define one primary mapper per class. by having
assign_mapper in the constructor of a class, creating a new mapper for the
Bar class which is in a static context, it creates a new mapper for the
Bar class each time Foo's __init__ is called; all calls to this after the
first w
Jonathan Ellis ([EMAIL PROTECTED]):
> On 7/29/06, POX <[EMAIL PROTECTED]> wrote:
> >Why undermentioned code will not work with SA 0.2.6 anymore?
> >sqlalchemy.exceptions.ArgumentError: Class ''
> >already has a primary mapper defined. Use is_primary=True to assign a new
> >primary mapper to the cl
On 7/29/06, POX <[EMAIL PROTECTED]> wrote:
Hi,Why undermentioned code will not work with SA 0.2.6 anymore?sqlalchemy.exceptions.ArgumentError: Class '' already has a primary mapper defined. Use is_primary=True to assign a new primary mapper to the class, or use non_primary=True to create a non pri
Hi,
Why undermentioned code will not work with SA 0.2.6 anymore?
After rinning:
| #!/usr/bin/python
|
| from sqlalchemy import *
| from sqlalchemy.mods.threadlocal import assign_mapper
|
| class Foo(object):
| class Bar(object):
| pass
| def __init__(self, url):
|
thanks for the help.
Calling dispose on all engines did fix the error for me.
Michael Bayer wrote:
> there are many on this list who dont think very highly of global
> variables ! :)
>
> id advise using your own create_engine function to keep track of created
> engines before calling SA's create
there are many on this list who dont think very highly of global
variables ! :)
id advise using your own create_engine function to keep track of
created engines before calling SA's create_engine strategy, and/or
monkeypatch sqlalchemy.create_engine to do so:
atexit_engines = []
I am using threadlocal.
Is there any global name that I can call in atexit function. The atexit
function is registered before any database stuff is accessed. The engine
create is ' engine = create_engine(connect_string,
strategy='threadlocal')'. In the atexit function I just want to
close
maybe engine.dispose() to explicitly close off everything first
On Jul 23, 2006, at 6:15 PM, Mike Bernson wrote:
> I am using ssh to port forward the connection to the database.
>
> I have some code that execute before any sqlalchemy that sets up a
> port forward from local host to mysql databas
I am using ssh to port forward the connection to the database.
I have some code that execute before any sqlalchemy that sets up a
port forward from local host to mysql database host. In this function
I do atexit to kill off the ssh that has the port forward.
I get a the following error when the p
Hello Michael,
Thanks a lot, that helped.
> yeah i can tell you exactly why this is this way.
> when the backref is created, the 0.1 series just re-used the join
> conditions from the original relation (in the case of a primary and
> secondary join on a many-to-many, it reverses them). in 0
yeah i can tell you exactly why this is this way.when the backref is created, the 0.1 series just re-used the join conditions from the original relation (in the case of a primary and secondary join on a many-to-many, it reverses them). in 0.2 there were some problems with thatmore complicated
Hello,
I have table "people" and table "accounts", each person can be payer
for any amount of accounts and reciever (perhaps I use wrong word, but
I can't find any better word) for any amount of accounts. This can be
done as two one-to-many relations. I also use backreferences.
And when I say som
you probably want to use bind parameters:
metadata.engine.execute(text("select * from test where url=:url"),
url="http://bubu.com/%_20";)
On Jul 19, 2006, at 12:19 PM, Gerhard Wohlgenannt wrote:
>
> hey everyone,
>
>
> I ran into a "problem" (at least for me) with using sqlalchemy.
>
hey everyone,
I ran into a "problem" (at least for me) with using sqlalchemy.
The query:
query = 'SELECT * FROM test WHERE url='http://bubu.com/%_20'
metadata.engine.execute(query)
raises an exception:
File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py",
when you delete the "series" objects, they are being removed from the
unit of work, but are not being removed from your Brand object. you
have to do that yourself. therefore when the deletion of Brand
occurs, it attempts to update the "Series" objects still attached to
the Brand and fails
Hi,
I encountered a strange situation when trying to delete an object from
a parent table with all its child
objects. I found that if you call objectstore.commit() after the
deletion of each child object, then you got problem when deleting the
parent object.
The parent table is called 'brand', w
theres a few things going on.
one is ticket #151. so to work around that do:
assign_mapper(Person, people,
properties={
'accounts' : relation(Account.mapper,
primaryjoin=(accounts.c.xxperson_id==people.c.person_id),
foreignkey=accounts.c.xxperson_id, private=True) }
)
the next i
Hello sqlalchemy-users,
I have some problems when I try to use polymorphic objects with
relation one to many (attached file will show problem).
In short words problem is following:
I create a mapper that is inherited from another mapper and I create a
table with "one to many" relation with
Michael Bayer wrote:
> Ok, theres a lot going on with this one
>
> the biggest problem youre hitting is that Element.mapper is made
> against the table "element_table", so when adding a property to
> Element.mapper, the primaryjoin has to somehow get back to that
> table. Element's mapper does
Ok, theres a lot going on with this one
the biggest problem youre hitting is that Element.mapper is made
against the table "element_table", so when adding a property to
Element.mapper, the primaryjoin has to somehow get back to that
table. Element's mapper doesnt know anything about th
Hi, can someone tell me, what's wrong with the attached SA mapping ?
test.py
Description: application/python
signature.asc
Description: OpenPGP digital signature
Michael Bayer wrote:
HD -
yah, youre good, this is how it works right now.
Will whatever changes you guys are talking about upset this use case ? I
like the simplicity of this, and it has worked well for alot of the
stuff I do.
Thanks
Huy
On Apr 4, 2006, at 9:04 PM, Daniel Miller wrote:
I think that last thing (getting the connection from the session)
ties into this. However, we better start a new thread for that.
I'll do that now.
ack no more threads ! im too overwhelmed by this one. im trying to
work up another pr
Michael Bayer wrote:
cn = SQLEngine.connection(...) # get pooled connection
what is cn ? since it has begin/commit stuff that returns
SQLTransactions, it cant be just a striaght DBAPI connection. Right
now, the SQLSession object is most analgous to this, it is a
connection-holding object
daniel -
glad youre involved with this discussion since youre the "main guy"
besides me with regards to objectstore.begin/commit design :)
your API below looks very nice. but there are some issues and
questions:
cn = SQLEngine.connection(...) # get pooled connection
what is cn ? sinc
On Apr 3, 2006, at 8:51 PM, Gambit wrote:
If this is accurate, a couple questions spring to mind:
First, when you do session.flush() without a surrounding
transaction, does
all the UOW actual commits occur within it's own transaction? (I sorta
assumed this is yes, but just want to make sure)
HD -
yah, youre good, this is how it works right now.
On Apr 3, 2006, at 8:53 PM, HD Mail wrote:
Michael,
This thread is making me think that I am using transactions in SA
incorrectly. I use a transaction decorator like below
def transaction(func):
def trans_func(*args, **kws):
First, let me state that engine.begin/commit has always confused the heck out
of me so I just acted like it didn't exist. Why do we need it? If transactions
are needed at the connection level, then use the connection.begin/commit for
that (maybe connection.begin() should return a SQLTransaction
Michael,
This thread is making me think that I am using transactions in SA
incorrectly. I use a transaction decorator like below
def transaction(func):
def trans_func(*args, **kws):
log.warn('* TRANS BEGIN ***')
engine.begin()
try:
f = func(*args, **k
So from what you said below:
trans = engine.begin()
# do some explicit SQL
trans.commit() # Commits all the explicit SQL, as we'd expect
objectstore.push_session(objectstore.Session(import_imap=True))
trans = session.begin_transaction()
foo = Foo()
bar = Bar()
# other UOW behavio
gambit -
the various push-based interfaces have some room for streamlining.
but the more immediate issue is that everyone is confusing
engine.begin()/commit() with objectstore.begin()/commit(), as youve
done below.
I am beginning to think a somewhat radical API change might be the
only w
Hey Michael,
Just looking at your usage there, but would it make any sense at all to
have engine.begin() and engine.push_session() turn into one method?
Does it make sense to create multiple sessions if you're not going to be
doing simultaneous transactions?
I think I'm looking for a way to some
Yah, ok , youre getting into features that were just written a few
weeks ago, if you want simultaneous transactions, theres a feature on
engine called "push_session"/"pop_session". you should not be
creating multiple engines for the same connection (i mean, you can,
but the experience will
Hello Michael,
Monday, April 03, 2006, 11:33:13 AM, you wrote:
So if I understand correctly if I want several simultaneously opened
transactions I have to construct several engines? Please correct me if
I am wrong.
So I changed behaviour of my program to following:
When tab with object opened fo
for any kind of transactional locking to occur, you have to use explicit
sessions with the engine. SQLAlchemy has two different levels of
operation; the "engine" level, which deals with SQL statements and
connections, and the "object relational mapper" level, which deals with
the state of objects
Hello Michael,
Monday, April 03, 2006, 1:05:27 AM, you wrote:
I am building a GUI program, where opertators will modify database by
hand. So if two operators open one row of table for edition at the
same time and then one commits and then second commits then changes
made by operator who commits f
"for update" is not a behavior SA's mapper was really designed to support.
if you do not use an explicit engine transaction, then the connection
object used for each operation will possibly be different each time, and
also a new cursor is used. its not like it will always be this way, but
ive nev
Hello,
I have a problem with "SELECT ... FOR UPDATE;" command.
I have a MySQL database, table created with TYPE=INNODB engine
specification with proper transaction isolation level set.
I want to issue "SELECT ... FOR UPDATE;" command to lock specific row
of table for updates.
Here's a sample sc
On Fri, Mar 31, 2006 at 06:47:00PM -0500, Michael Bayer wrote:
> hey dale -
>
> ive created a test suite for this in test/objectstore.py PrivateAttrTest,
> along with a test for another behavior of private attributes that
> interacts with this one intimately. I took off the assertion that was
> s
hey dale -
ive created a test suite for this in test/objectstore.py PrivateAttrTest,
along with a test for another behavior of private attributes that
interacts with this one intimately. I took off the assertion that was
stopping you and made some other adjustments to support the operation and
t
this is definitely the behavior, and it should probably be improved. I
made it raise an explicit exception so at least the issue is easy to spot,
as opposed to it making it all the way into the commit() where things
really get messed up. i would imagine the same problem occurs if you
remove the b
[Sorry if this makes it onto the list twice. I posted through
Gmane NNTP and was told the message was sent to moderation. I haven't
seen it appear on the list yet.]
Greetings. I've got a database with a parent/children
relationship (one-to-many, to clarify). When a parent is de
you are not the first to have these particular issues, I am going to
look into the docs today and see if I can break out more clearly the
job of the unit of work, and what it does do/does not do, as the
various emails ive gotten on this type of thing are clarifying for me
some notions that
Thanks alot Michael for your detailed reply. I think most of my
confusions were due to some pre-convieved ideas I had regartding ORMs.
I wasn't aware of the whole concept of sessions and, probably because
of 'backref's, I had the misconception that sqlalchemy would do
everything.
Now that I unders
On Mar 25, 2006, at 12:17 AM, Tiago Cogumbreiro wrote:this is correct, SQLAlchemy's primary job is to generate SQL statements.it has minimal attribute management capabilities in order to track changesfor the purposes of committing the changes on a graph of objects, as wellas a "backreference" funct
On 3/24/06, Michael Bayer <[EMAIL PROTECTED]> wrote:
[snip]
> Tiago Cogumbreiro wrote:
> > Meanwhile I'm having a bit of a problem handling deleted elements.
> > I've picked up your 'backref_tree' example and added some testcases to
> > explain my problem: after deleting the elements of a relation
Tiago Cogumbreiro wrote:
> Meanwhile I'm having a bit of a problem handling deleted elements.
> I've picked up your 'backref_tree' example and added some testcases to
> explain my problem: after deleting the elements of a relation the
> other side - the attribute - of the relation is not refreshed
Hello list,
I'm trying to learn Sqlalchemy. After reading the docs I decided to
create an example to test what I had learned so far. I usually do this
by creating a unittest.TestCase class and testing if everything is
working according to what I expect it to.
Meanwhile I'm having a bit of a probl
OK, I committed a small addition to assign_mapper that will create a
default __init__ method, if one does not already exist on the given
class. the below example works now.
On Jan 15, 2006, at 3:37 AM, Murat Özsöyler wrote:
Hi,
Back from the long holidays, I've just checked out svn revisi
Michael Bayer wrote:
I think the keyword-enabled __init__() method created by assign_class ()
should be created within the sqlalchemy assign_mapper() method, if the
given class doenst have an __init__() method defined already. that
way code like this would work, if no other __init__() meth
I think the keyword-enabled __init__() method created by assign_class
() should be created within the sqlalchemy assign_mapper() method, if
the given class doenst have an __init__() method defined already.
that way code like this would work, if no other __init__() method was
already creat
Murat Özsöyler wrote:
The following code inserts a row with the values: ID=1, NAME=u''.
m = trial2.Master(NAME="Deneme")
trial2.objectstore.commit()
If I comment out the default parameter for NAME column then I get this
exception:
Not sure where the 'trial2' comes from, but you need to
Hi,
Back from the long holidays, I've just checked out svn revision 817.
Given the following module:
from sqlalchemy import *
engine = create_engine("sqlite://filename=trial2.sqlldb")
MASTER = Table("MASTER", engine
, Column("ID", Integer, Sequence("MASTER_ID_SEQ"), primary_key=True,
nullab
70 matches
Mail list logo