Try moving the metadata.create_all(engine) below the User class declaration.
Like:
snipped code
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String)
fullname = Column(String)
password = Column(String)
def __init__(self, name,
On Wed, Feb 25, 2009 at 11:39, Gregg Lind gregg.l...@gmail.com wrote:
How does one create a TypeDecorator to export and import JSON to a
database using SA?
I did something like that recently:
-
from sqlalchemy import types
import simplejson
class
] and
types.TypeEngine.is_mutable().
[1] -
http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/types.html#sqlalchemy.types.MutableType
On Wed, Feb 25, 2009 at 10:27 AM, Roger Demetrescu
roger.demetre...@gmail.com wrote:
On Wed, Feb 25, 2009 at 11:39, Gregg Lind gregg.l...@gmail.com wrote:
How does one create
On Tue, Jan 27, 2009 at 14:31, Michael Bayer mike...@zzzcomputing.com wrote:
there's nothing stopping you from just executing the SQL directly.
I've never actually heard of CREATE TABLE AS before, but I just
checked it out and you can certainly generate the SQL programmatically
from a
On 5/15/08, Yannick Gingras [EMAIL PROTECTED] wrote:
Michael Bayer [EMAIL PROTECTED] writes:
easy enough to build yourself a generic MapperExtension that scans
incoming objects for a _pre_commit() method.
Yeah indeed. I used this:
--
class
On 5/15/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
speed wise, this is better: hasattr is implemented as getattr + try
except. i would do it even:
f = getattr(instance, _pre_insert, None)
if f: f()
Thus the func name is spelled only once - avoids stupid mistakes.
Good point...
Hi Lele -
On Dec 19, 2007 9:08 PM, Lele Gaifax [EMAIL PROTECTED] wrote:
On Wed, 19 Dec 2007 10:21:15 -0500
Michael Bayer [EMAIL PROTECTED] wrote:
sane_rowcount is set to False on FB probably because someones
version of FB did not support it correctly. it might be worth
tracking it
Hi all,
A coworker has doing some experiments with deferred column loading and
noticed that SA doesn't raise any exception when defer(), undefer() or
undefer_group() are called with an invalid column ou group name.
In other words, if you try to follow the example from:
On Nov 23, 2007 2:41 PM, Michael Bayer [EMAIL PROTECTED] wrote:
hey Roger -
assuming this has been confirmed with version 0.4.1 you can add a trac
ticket for this.
I am not in front of a machine with SA installed, but my coworker told
me it was 0.4.1...
I'll test it at home and add a
hei Michael -
On Nov 23, 2007 2:41 PM, Michael Bayer [EMAIL PROTECTED] wrote:
hey Roger -
assuming this has been confirmed with version 0.4.1 you can add a trac
ticket for this.
- mike
It's done: #878
Cheers,
Roger
--~--~-~--~~~---~--~~
You received
Hei Wes and Paul...
On 10/29/07, Wes Duff [EMAIL PROTECTED] wrote:
Hey whats going on.
I am a new sqlalchemist as well but lets see if this helps any.
This is how I am getting a list of all names that corrispond with my
document names class.
names = [ c.name for c in
Dammit...
Sent it to the wrong ML.. :-/
Sorry about the noise...
Roger
On 10/30/07, Roger Demetrescu [EMAIL PROTECTED] wrote:
Hei guys...
I have just tried to reopen a ticket, but I am getting this error:
Submission rejected as potential spam (Akismet says content is spam)
I
Werner,
On 10/4/07, Werner F. Bruhin [EMAIL PROTECTED] wrote:
Scanning firebird.py I noticed that:
FBText returns BLOB SUB_TYPE 2
Shouldn't that be BLOB SUB_TYPE 1 or BLOB SUB_TYPE TEXT
and FBBinary returns BLOB SUB_TYPE 1
Shouldn't that be BLOB SUB_TYPE 0
See Helen's FB Book on
Trying to fix the NumericTest (testtypes.py) for firebird backend, I
came to this patch for FBNumeric:
+def bind_processor(self, dialect):
+return None
+
+def result_processor(self, dialect):
+if self.asdecimal:
+return None
+else:
+def
Hi Werner !
On 10/4/07, Werner F. Bruhin [EMAIL PROTECTED] wrote:
Scanning firebird.py I noticed that:
FBText returns BLOB SUB_TYPE 2
Shouldn't that be BLOB SUB_TYPE 1 or BLOB SUB_TYPE TEXT
and FBBinary returns BLOB SUB_TYPE 1
Shouldn't that be BLOB SUB_TYPE 0
Well, I personally
On 9/28/07, Glauco [EMAIL PROTECTED] wrote:
Yes...
this is the example
session.query( UnitaAziendale ).order_by(Anagrafica.c.nome)
Ok... do you remember about the .join() or .outerjoin() I told you before ?
That's how you should declare you Query:
q = session.query( UnitaAziendale
Hi Glauco
On 9/27/07, Glauco [EMAIL PROTECTED] wrote:
Hi all,
how can i know the correct name of a table compiled into qry that SA
has automatically aliased?
for example:
a join b join c join d..
sqlalchemy has created something like
select blabla
from a AS anon_b406
join.
On 9/27/07, Glauco [EMAIL PROTECTED] wrote:
If so, I think I know what you are doing wrong... you must use Query's
.join() or .outerjoin() method. Like that:
session.query(ObjectA).join('property_b').order_by(ObjectB.c.foobar)
Where 'foobar' maps to the column from B table which you want
On 9/27/07, Glauco [EMAIL PROTECTED] wrote:
Glauco, can you send a small test script reproducing the error ?
I'll gladly take a look at that...
Cheers,
Roger
Yes...
this is the example
session.query( UnitaAziendale ).order_by(Anagrafica.c.nome)
SNIP
Thanks Glauco...
But
On 9/8/07, Lukasz Szybalski [EMAIL PROTECTED] wrote:
On 9/7/07, Paul Johnston [EMAIL PROTECTED] wrote:
Hi,
And if I wanted to select a year and group by year?
select User.Year from User group by User.Year
db.execute(select([User.Year]) ???
Have a look at
Michael,
On 9/10/07, Michael Bayer [EMAIL PROTECTED] wrote:
hey Roger -
can you reopen ticket #570 and attach your patch there ? FTR, the
0.4 codebase does this differently and is probably correct over
there (but also, not tested since I dont have FB).
I'll do that tonight... and will
Michael
On 9/10/07, Michael Bayer [EMAIL PROTECTED] wrote:
hey Roger -
can you reopen ticket #570 and attach your patch there ? FTR, the
0.4 codebase does this differently and is probably correct over
there (but also, not tested since I dont have FB).
I guess you meant #370.. :)
Well,
Hi Michael,
Do you remember this thread ? : http://tinyurl.com/2c5tzc
We have recently upgraded SA from 0.3.7 (with firebird.py modified by
ourself) to 0.3.10, and we got this exception:
Updated rowcount 1 does not match number of objects updated 2
After some research, we found out that
Hi Michael,
Some of my coworkers had the same needs of Gaetan... And while I
understand your solution, I figure out if SA could have it natively
(detecting the presence of a dictionary)...
Somethink like:
query.get(dict(columnB='foo', columnA='bar')
Lazy programmers are the best ones... :)
On 6/13/07, Marco Mariani [EMAIL PROTECTED] wrote:
Roger Demetrescu ha scritto:
query.get(dict(columnB='foo', columnA='bar')
Lazy programmers are the best ones... :)
That's the reason lazy programmers share a superclass for all their
domain objects... hint, hint :-)
Yeaph, I
On 6/13/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Some of my coworkers had the same needs of Gaetan... And while I
understand your solution, I figure out if SA could have it natively
(detecting the presence of a dictionary)...
Somethink like:
query.get(dict(columnB='foo',
On 6/13/07, kwarg [EMAIL PROTECTED] wrote:
I don't explicitly create a transaction - it's all done by TG/SA
behind the scenes.
Take a look at this thead (the 8th message):
http://tinyurl.com/39bytt
Where it says:
As of TG 1.0.2+ you can now get access to the SA transaction via
running on SUSE Linux.
John
On 30 May, 19:47, Roger Demetrescu [EMAIL PROTECTED]
wrote:
Michael, the patch did the trick...
I was able to print the statement, execute it, and also do some
inserts using ORM...
Now the second part of my problem, which is not fixed yet... ;)
here
Hi Michael,
I don't know when the following problem began, but anyway, I've tested
it with rev.2672 and the problem persists
Having this script:
==
from sqlalchemy import *
db = create_engine(firebird://user:[EMAIL PROTECTED]//database.fdb)
metadata =
Michael, the patch did the trick...
I was able to print the statement, execute it, and also do some
inserts using ORM...
Now the second part of my problem, which is not fixed yet... ;)
here is the script (now using default value/expression):
from datetime
Hi Michael,
I'm having the same problem described in ticket 370.
Eg.:
mapper(User, users_table, properties = dict(
preferences = relation(UserPrefs, cascade=all, delete-orphan),
))
when I try to do this:
u = session.query(User).get(1)
u.preferences.clear()
session.flush()
it thows a
Thanks Michael,
I'll give it a try at monday morning...
Have a nice weekend... :)
[]s
Roger
On 5/25/07, Michael Bayer [EMAIL PROTECTED] wrote:
ive turned off firebird's supports_sane_rowcount feature, update to
rev 2642 for now.
On May 25, 2007, at 2:43 PM, Roger Demetrescu wrote
Michael,
I got some errors (NoSuchColumnError) after upgrading SA from 0.3.6 to 0.3.7
After some research in mailing list history, I found this thread [1]:
I modified my sqlalchemy/databases/firebird.py :
---
class FBDialect(...
...
def
Thanks Michael, both the 2 approaches did the trick... :)
On 4/16/07, Michael Bayer [EMAIL PROTECTED] wrote:
with firebird, the appropriate database closed exceptions need to
be added to its dialect's is_disconnect() method...someone needs to
submit a patch for that (you can create one
On 4/11/07, King Simon-NFHD78 [EMAIL PROTECTED] wrote:
Roger Demetrescu wrote:
Do you mean using the traceback module ? I've just searched about it
and I guess I should use this:
try:
# do my stuff
except:
traceback.print_exc(file=sys.stdout)
raise
:
'PropertyLoader' object has no attribute 'strategy'
Thanks
Roger
On 4/11/07, Roger Demetrescu [EMAIL PROTECTED] wrote:
Hi all,
I have a daemon with 2 threads to control upload / download of some
files (they use SQLAlchemy to find out which files must be worked).
Once a week, my daemon's
Hi iain
On 2/5/07, iain duncan [EMAIL PROTECTED] wrote:
Below is my code in case someone has time to look at it. At the moment it
works to get
article.ordering as a list instead of one field. Is there a way to tell it
that this is only supposed to be one item?
uselist is your friend.. :)
37 matches
Mail list logo