Hello list, I'm new to sqlalchemy and database programming. I have
defined a declarative class
import sqlalchemy as SQL
import sqlalchemy.ext.declarative as Declare
import sqlalchemy.orm as ORM
import datetime
Base = Declare.declarative_base()
class CUniversity(Base):
__tablename__ =
Hi all,
I created a table with the following column:
Column('last_updated', DateTime, PassiveDefault(func.current_timestamp
()), onupdate=func.current_timestamp())
Maybe I don't understand how onupdate works.
I would like to have this column to be changed every time the row is
updated,
but it
you'd say, s.alias().select()
it makes subqueries which MySQL probably doesn't require.
On Dec 5, 2008, at 10:35 PM, Bo Shi wrote:
Thanks; the monkeypatch approach works nicely. Using the alias()
method will raise
AttributeError: 'Alias' object has no attribute '_order_by_clause'
that is the correct syntax. It will take effect any time an update()
construct is used or when the ORM updates a row. Because onupdate is
not a DDL-side construct, it will not take effect if you use a plain
text UPDATE statement or if the update is otherwise not emitted by the
Column('last_updated', DateTime, PassiveDefault(func.current_timestamp
()), onupdate=func.current_timestamp())
Maybe I don't understand how onupdate works.
I would like to have this column to be changed every time the row is
updated,
but it doesn't work.
I just use something like:
Hi all,
I have two tables in my schema with circular references and I don't know
hot to create them.
tbl['anagrafica']=Table('anagrafica',database.metadata,
Column('id', Integer, Sequence('anagrafica_id_seq'),
primary_key=True, nullable=False),
Column('nome', Unicode(200),
Hi all,
I would like to create an index with a condition, like this:
CREATE UNIQUE INDEX univocita_codice_aziendale
on azienda (lower(codice_aziendale), stato_record)
WHERE stato_record = 'A'
Is there a way to do that, using the Index() command?
j
thanks for the quick reply. i kept trying with it and no have reached
the utter state of confusion.
the specification of Unicode versus String in the table def's coupled
with actual str representation
has my totally confused. here's a quick script, have a look at the
mysql table itself to see
You're right about CSS selectors; the simple fix for this without re-
generating any source, is just to instruct the browser to not double
up on the indentation when it sees a ul nested in a blockquote. Hey
wait, the problem is already fixed. Looks great today. The lists
too; thanks for the
Postgres supports this using the postgres_where keyword argument sent
to Index(). Otherwise use DDL().
http://www.sqlalchemy.org/docs/05/reference/dialects/postgres.html?highlight=postgres_where#indexes
specify use_alter=True to one or both ForeignKey constructs.
On Dec 6, 2008, at 12:37 PM, jose wrote:
Hi all,
I have two tables in my schema with circular references and I don't
know
hot to create them.
tbl['anagrafica']=Table('anagrafica',database.metadata,
Column('id',
Yes, Michael, I see how it works now. Thank you
j
Michael Bayer wrote:
that is the correct syntax. It will take effect any time an update()
construct is used or when the ORM updates a row. Because onupdate is
not a DDL-side construct, it will not take effect if you use a plain
text
the use_alter=True raises this error:
ForeignKeyConstraint(['id_operatore'],['operatore.id'],use_alter=True),
File /usr/lib/python2.4/site-packages/sqlalchemy/schema.py, line
701, in __init__
raise exceptions.ArgumentError(Alterable
ForeignKey/ForeignKeyConstraint requires a name)
Are these features available on ver. 0.3?
j
Michael Bayer wrote:
Postgres supports this using the postgres_where keyword argument sent
to Index(). Otherwise use DDL().
http://www.sqlalchemy.org/docs/05/reference/dialects/postgres.html?highlight=postgres_where#indexes
I gave it a name but now...
raise FlushError(Circular dependency detected + repr(edges) +
repr(queue))
sqlalchemy.exceptions.FlushError: Circular dependency detected
sqlalchemy.topological._EdgeCollection object at 0xb73f356c[]
jose wrote:
the use_alter=True raises this error:
Hi, I have been working on a little project to transform excel docs
(actually them saved as csv files) into SQLAlchemy objects.
Of course this is tailored for my own database which I need to import
but I have been splitting it into api more and more and eventually
plan to release it as some
that's an ORM problem.you might want to look into the
post_update flag if you need to flush two mutually dependent rows.
See the relation() docs for details.
On Dec 6, 2008, at 3:41 PM, jose wrote:
I gave it a name but now...
raise FlushError(Circular dependency detected +
they are not. you can of course issue any DDL you'd like using
engine.execute(somestring).
On Dec 6, 2008, at 3:39 PM, jose wrote:
Are these features available on ver. 0.3?
j
Michael Bayer wrote:
Postgres supports this using the postgres_where keyword argument sent
to Index().
On Dec 6, 2008, at 4:16 PM, Jorge Vargas wrote:
So in order to make code a lot more readable I was thinking I could
use the syntax SA uses for filter and such so I can write the
_excel_to_field as
_excel_to_field = {
'First Name' : 'Contact.first_name',
'Last Name' :
Hello.
I had a problem described in subject. Here is the testcase:
import sqlalchemy
engine = sqlalchemy.create_engine('sqlite:///:memory:')
metadata = sqlalchemy.MetaData(engine)
class ForeignKey(sqlalchemy.Column):
def __init__(self, name, foreign_column, *args, **kwargs):
fk =
On Dec 6, 2008, at 4:27 PM, Angri wrote:
1. What about another side-effects depending on clsname? Is it
actually safe to extend sqlalchemy.schema.Column, or it may have
unpredictable behavior similar to that i've encountered?
The Column object is one of the most key classes in all of
Right; my bad - I misread the instructions.
On Sat, Dec 6, 2008 at 9:41 AM, Michael Bayer [EMAIL PROTECTED] wrote:
you'd say, s.alias().select()
it makes subqueries which MySQL probably doesn't require.
On Dec 5, 2008, at 10:35 PM, Bo Shi wrote:
Thanks; the monkeypatch approach works
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
I have talked to my customers, and they agreed that your solution is
great.
To match their demands, I've changed two things:
1. If the object exists in the db during construction than it's
returned, else the object returned is a new object (that isn't
returned).
2. All the attributes that
24 matches
Mail list logo