[sqlalchemy] Re: Locking tables

2009-11-02 Thread Nathan Harmston
/speeding-up-inserts-on-mysql/ Thanks for the advice, Nathan 2009/10/31 Michael Bayer : > > > On Oct 30, 2009, at 9:45 AM, Nathan Harmston wrote: > >> >> Hi, >> >> I have a script which will process a large amount of data and save >> some of those results

[sqlalchemy] Locking tables

2009-10-30 Thread Nathan Harmston
Hi, I have a script which will process a large amount of data and save some of those results to the database. This takes a large amount of time and so what I would do in something like java is to lock the tables before processing, do the work, and then lock them after processing..concurre

[sqlalchemy] Re: Vertical partitioning, mappers and foreign keys

2009-08-18 Thread Nathan Harmston
und correctly. Is there something going wrong. I am using 0.5.3 of SQLAlchemy. Any help greatly appreciated yet again, Nathan PS I continued the old thread as its still regarding the same topic...I hope this is ok. 2009/8/14 Michael Bayer : > > Nathan Harmston wrote: >> &

[sqlalchemy] Vertical partitioning, mappers and foreign keys

2009-08-14 Thread Nathan Harmston
HI, I m currently trying to vertical partition my database and I have split it into two groups of tables (say { documents, table1, table2 } and { table3 }. So I have s_engine = create_engine(t_database_string)#, echo=True) #echo="debug")#, echo=True) t_engine = create_engine(t_database_string)

[sqlalchemy] Accessing attributes hidden by a join

2009-08-04 Thread Nathan Harmston
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, ForeignKey("sentences

[sqlalchemy] Unique parent class and various subclasses

2009-07-07 Thread Nathan Harmston
Hi, Currently I have a mapper like this: class Entity: def __init__(self, type, create, sentence_id, start, end): self.type = type self.create = create self.sentence_id = sentence_id self.start = start self.end = end class Interval: def __init

[sqlalchemy] Accessing classes a table away in a mapper - why does this work?

2009-05-27 Thread Nathan Harmston
Hi, I have been struggling with trying to create relations which reference objects a couple of tables away. e.g Sentence has many entities Entity has many NormalisedVersion NormalisedVersion has one Gene kind of thing and was trying to link from Sentence to genes directly. secondary = entiti

[sqlalchemy] Re: Accessing classes a table away in a mapper

2009-05-20 Thread Nathan Harmston
can't see the final step to finish it off. Many thanks in advance Nathan 2009/5/20 Nathan Harmston : > The problem was solved by using a join query and then specifying both > foreign keys and the secondary argument to the relation. > > Many thanks, > > Na

[sqlalchemy] Re: Accessing classes a table away in a mapper

2009-05-20 Thread Nathan Harmston
The problem was solved by using a join query and then specifying both foreign keys and the secondary argument to the relation. Many thanks, Nathan secondary = sentences_table.join(tag_table.join(processed_tags_table, processed_tags_table.c.tag_id == tag_table.c.tag_id),

[sqlalchemy] Joined table inheritance mapping issues

2009-05-18 Thread Nathan Harmston
Hi, I am playing with the mapping inheritance structures to my database. I have a the following hierarchy: class Tag(object): pass class NormalisedNameTag(Tag): pass class NormalisedPlaceTag(Tag): pass The idea is that a pre-processing step will produce a series of tags and then

[sqlalchemy] Accessing classes a table away in a mapper

2009-05-18 Thread Nathan Harmston
Hi, I am trying to map a relation in class which allows it to access objects from a couple of tables away ie. class Zone(object): pass class Sentence(object): pass class RawTag(object): pass class ProcessedTag(RawTag): pass mapper(RawTag, tag_table) mapper(Sentence, sentence_ta

[sqlalchemy] Re: Using column_property getting no results

2009-05-18 Thread Nathan Harmston
t 2:13 PM, Nathan Harmston wrote: > >> >> HmmI tried it again with echo=debug and some output but it seems >> that my query returns no results (although when I try it on its own it >> returns the right ones). When I try to just use it with only one name >> in bar_t

[sqlalchemy] Re: Using column_property getting no results

2009-05-17 Thread Nathan Harmston
again, Nathan 2009/5/15 Michael Bayer : > > put echo='debug' to see what the results are. > > On May 15, 2009, at 8:08 AM, Nathan Harmston wrote: > >> >> Hi, >> >> I am trying to use a column property, I have a class Foo: >> >> class F

[sqlalchemy] Using column_property getting no results

2009-05-15 Thread Nathan Harmston
Hi, I am trying to use a column property, I have a class Foo: class Foo(object): pass which is mapped to a table foo_table and it has multiple names which are stored in bar_table with foo_id as the primary key in Foo and ForeignKey in bar_table. I am trying to use a column property to acces

[sqlalchemy] Using orderedlist with a secondary table

2009-01-30 Thread Nathan Harmston
Hi, I am currently trying to make a relation between Document and Author, where there is a many to many association which is dealt with by a secondary table and I am trying to store the position of an author in the author list. mapper(Paper, document_table, properties={'journal':relation(Journal,

[sqlalchemy] Re: SQL Expressions as Mapped Attributes

2009-01-27 Thread Nathan Harmston
el Bayer > > On Jan 26, 2009, at 12:50 PM, Nathan Harmston wrote: > > Hi, > > I am currently trying to use an SQL expression as a mapped attribute. I > have a table called species_table and a species_names_tables, there is a one > to many relationship between them on specie

[sqlalchemy] SQL Expressions as Mapped Attributes

2009-01-26 Thread Nathan Harmston
Hi, I am currently trying to use an SQL expression as a mapped attribute. I have a table called species_table and a species_names_tables, there is a one to many relationship between them on species_table.c.taxa_id and species_names_table.c.taxa. So one species can have multiple names. I am current

[sqlalchemy] Looking for a pattern/simple way to simplify parsing and storing files in a database

2009-01-13 Thread Nathan Harmston
Hi everyone, I m trying to get to grips with SQLAlchemy by parsing a file, extracting certain fields and then storing them in a database. I am currently using the object relational and trying to get a sense of how it all works. I have two objects Paper and Author, which is a many to many relations

[sqlalchemy] exceptions.ArgumentError when trying to map class to a table

2008-12-17 Thread Nathan Harmston
Hi everyone , I have the following setup (snipped): in_table = Table('in', metadata, Column('id', Integer, primary_key=True), Column('pA', String(6), ForeignKey('p.id'), nullable=False), Column('pB', String(6), ForeignKey('p.id'), nullable=Fal

[sqlalchemy] Problem Mapping table/relationship to a dictionary.

2007-08-24 Thread Nathan Harmston
Hi, I m trying to write a way of storing a 2 level dictionary in a database. class Foo(object): def __init__(self): self.a = {} def __iadd__(self, i): if i not in self.a: self.a[i] = {} return self def keys(self): for i in self.a.keys():

[sqlalchemy] Problems trying to run a query - typeerror

2007-06-10 Thread nathan harmston
HI, I m currently trying to build an api for a database and I really like the way that Djangos manager ( Class_name.objects ). This seems very intuitive for me. After reading through the some of the django source and getting slightly confused I ve implemented a basic version for one of my tables.

[sqlalchemy] Re: Mapping existing structure of a database

2007-06-04 Thread nathan harmston
What kind of overhead is associated with using the autoload flag? What kind of overhead would be associated with this over a network? (with a remote database). Is there a way to "dump" the structure of a database to a file and import this as a kind of module? Thanks Nathan --~--~-~--~--

[sqlalchemy] Mapping existing structure of a database

2007-06-04 Thread nathan harmston
Hi, I m currently playing with using sqlalchemy to map a pre-existing database to objects. I ve had a quick look through the docs and not being able to find anything about this. Does SQLAlchemy support "introspection" (if thats the right word, probably not) into existing databases, if so how? If