On Aug 3, 5:07 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Ok that's kind of interesting. as a general rule, the ORM doesn't like
to make assumptions. such as here, there is a lazyloader on
User.keywords, which says query for these Keyword objects, without any
knowledge of what
Hi,
All the information I need, I can get in 1 SQL query with this query
and model:
categories=Article.query.filter(Article.parent == None).all()
class Article(DefaultEntity):
name = Field(Unicode(64), index=True)
parent = ManyToOne('Article')
children = OneToMany('Article',
I'm using MySQL and want to use a combined primary-key where the
second column is autogenerated while the first part is an assigned
value. This is how my Table-definition looks like:
table_a = Table('table_a', metadata,
Column('assigned_id', Integer(), primary_key=True,
autoincrement=False),
Hello
M trying to use to_char function which works on postgres but gives
error on mysql.
My code is
import sqlalchemy
from sqlalchemy import *
engine = sqlalchemy.create_engine(mysql://root:r...@localhost:3306/
newdb,echo=True)
meta = MetaData(engine)
t1 = Table(Table1,meta)
id =
Figured out how to run the called procedure.
sql = db.sa.text(select trans_value from t(:totrans, :username),
bindparams=[db.sa.bindparam('totrans', 'some text
orig'),
db.sa.bindparam('username', me.name)])
result =
Hi,
maxi wrote:
Hi,
I´ve just using sqlalchemy 0.5.1 with python 2.6 and turbogers, but I
found a little problem trying to configurate adjacency relationship
with declarative base.
My object class is something like this:
class QueryGroup(DeclarativeBase):
__tablename__ =
Hi everyone, I am trying to get access to attributes which are hidden by a join:
I have two tables
intervals_table = Table(intervals, metadata,
Column(interval_id, Integer, primary_key=True),
Column(sentence_id, Integer,
Did you consider using the mapper
mapper(Entity, entities_table, properties={
'interval' : relation(Interval)
})
instead of the join()?
Optional arguments on the relation can control things like lazy vs eager
loading, and scalar vs list for 1-1 or 1-n relationships.
If you need to use
Just started with SQLAlchemy, been great so far but have been tripped
up by the following;
Using the standard ORM stuff of;
Base = declarative_base()
class Temp(Base):
__tablename__ = 'temp'
somecol = Column('somecol', Integer)
In posgres this declares 'somecol' as an `integer' but I
for some reason I cannot get my session to commit within a class
Here is the error.
Traceback (most recent call last):
File /usr/local/lib/python2.6/dist-packages/cherrypy/
_cprequest.py, line 606, in respond
cherrypy.response.body = self.handler()
File
Hi,
does anybody know how can I use the default param in the Column
class to define a new value which comes from a Firebird generator? I
get the same thing with
cod_objeto = self.conexion.execute('SELECT FIRST 1 NEXT VALUE FOR GEN_
%d FROM RDB$DATABASE' % cod_clase).fetchone()[0]
eagerload() doesn't need join_depth. it will eagerload what you tell it
to, i.e.
query.options(eagerload_all('Article', 'Article', 'Article'))
Kees van den Broek wrote:
Hi,
All the information I need, I can get in 1 SQL query with this query
and model:
Is there a possibility to connect to Netezza db server?
--~--~-~--~~~---~--~~
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
Christian Schwanke wrote:
I'm using MySQL and want to use a combined primary-key where the
second column is autogenerated while the first part is an assigned
value. This is how my Table-definition looks like:
table_a = Table('table_a', metadata,
Column('assigned_id', Integer(),
ast wrote:
Hello
M trying to use to_char function which works on postgres but gives
error on mysql.
My code is
import sqlalchemy
from sqlalchemy import *
engine = sqlalchemy.create_engine(mysql://root:r...@localhost:3306/
newdb,echo=True)
meta = MetaData(engine)
t1 =
Werner F. Bruhin wrote:
Figured out how to run the called procedure.
sql = db.sa.text(select trans_value from t(:totrans, :username),
bindparams=[db.sa.bindparam('totrans', 'some text
orig'),
db.sa.bindparam('username', me.name)])
result
this appears to be an Elixir issue, check on their list.
kportertx wrote:
for some reason I cannot get my session to commit within a class
Here is the error.
Traceback (most recent call last):
File /usr/local/lib/python2.6/dist-packages/cherrypy/
_cprequest.py, line 606, in respond
dusans wrote:
Is there a possibility to connect to Netezza db server?
to use SQLalchemy with a certain backend, you have to answer these questions:
1. is it SQL ?
2. is there a python DBAPI available ?
yes to both, then a new dialect module can be constructed that interfaces
with this
Nathan Harmston wrote:
Hi everyone, I am trying to get access to attributes which are hidden by a
join:
I have two tables
intervals_table = Table(intervals, metadata,
Column(interval_id, Integer, primary_key=True),
Column(sentence_id,
Hi Michael,
thanks for your quick reply (again).
I'm currently on the 0.6 branch after I ran into the first problem a
few days ago but in my actual schema, the autogenerated ID in the
second PK-column is referenced by another table that is mapped as a
one-to-many relation. When persisting the
Christian Schwanke wrote:
Hi Michael,
thanks for your quick reply (again).
I'm currently on the 0.6 branch after I ran into the first problem a
few days ago but in my actual schema, the autogenerated ID in the
second PK-column is referenced by another table that is mapped as a
one-to-many
Thanks, all seems to be working fine now.
Ed
On 31 Jul 2009, at 15:48, Michael Bayer wrote:
try r6225
Ed Singleton wrote:
Revision 6209 in the sa06 branch breaks everything with MSSQL on Mac
and Linux. It's not a major problem as I've reverted back. But I'd
thought I'd let you know.
Thanks for this. I've been playing and learning more over the last few
days. This is all AFAIK, but odbc.ini is the unixodbc/iodbc config
and doesn't accept a charset. freetds.conf does accept a default
client charset, but this shouldn't be necessary if you're using tds
8.0 as that
Michael Bayer wrote:
Werner F. Bruhin wrote:
Figured out how to run the called procedure.
sql = db.sa.text(select trans_value from t(:totrans, :username),
bindparams=[db.sa.bindparam('totrans', 'some text
orig'),
I moved to elixir when declarative_base caused the exact same issue.
Elixir still uses sqlalchemy's session so am I at least using the
session correctly?
Here is declarative_base code
#!/usr/bin/env python
#
#
#
kportertx wrote:
I moved to elixir when declarative_base caused the exact same issue.
Elixir still uses sqlalchemy's session so am I at least using the
session correctly?
thats unlikely. the error claims it is looking for a nonexistent table
called __main__test, which is the kind of name
Hi all!
I have following model classes:
Entity = sqlalchemy.ext.declarative.declarative_base(name='Entity')
class Ocean(Entity):
__tablename__ = 'oceans'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
name = sqlalchemy.Column(sqlalchemy.String(20), nullable=False)
@ Michael Bayer,
Sorry forgot to post the new error from the code without elixir, also
there was a problem with the session.commit statement in that last
post. It was supposed to be session.commit() not session.commit.
Traceback (most recent call last):
File
kportertx wrote:
@ Michael Bayer,
Sorry forgot to post the new error from the code without elixir, also
there was a problem with the session.commit statement in that last
post. It was supposed to be session.commit() not session.commit.
ok so, you called create_all() after all modules
To answer my own question;
I imported -
from sqlalchemy.databases.postgres import PGBigInteger
and then used that inplace of Integer in my column declarations.
Apart from loosing Database agnosticism is there anything wrong with
doing this?
I tested inserting, querying and it all appeared
On Aug 4, 2009, at 8:23 PM, sim wrote:
To answer my own question;
I imported -
from sqlalchemy.databases.postgres import PGBigInteger
and then used that inplace of Integer in my column declarations.
Apart from loosing Database agnosticism is there anything wrong with
doing this?
I
But this is all in one file, create_all() after all classes defining
the model are loaded.
I noticed earlier I accidentally posted the error twice, here is the
source code. Could you try running this and see if you run into the
same problem.
Again this all one file. This is also my first week
Could this have something to do with using a database in memory? I
just noticed if I call create_all() within my class every time I want
to update the database it works. Also it is able to add multiple
items by pressing refresh. But when I browse away from the web page
and return later it
33 matches
Mail list logo