[sqlalchemy] Inserting Entry Fastest way
Hi, I am working on a database design that I am required to use lots of tables with one-to-many relationship. As a consequence of the design, I need to insert thousands of entries. I tried session.add(), session.merge, however none of them is fast enough for me to meet the requirements. I was wondering if you can suggest me an efficient way through either ORM or ORM+Core. Thanks! -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[sqlalchemy] Joining Algorithmically
Hi, I have four tables that I would like to join algorithmically. Element with element_prop, elementprop with element_typeprop in one direction and element with element_type in the other. I would like to do this in one line as I am concerned about the number queries must be minimal given I am working in a gigantic database. q=session.query(element).outerjoin(element_prop,element.element_id==element_prop.element_id).outerjoin(element_prop,element_type_prop.element_type_prop_id==element_prop.element_type_prop_id).outerjoin(element,element_type.element_type_id==element.element_type_id) I replicate the format I'd use for native SQL. However, I come across aliasing issues: ERROR 1066 (42000): Not unique table/alias: 'element_prop' when I run the generated SQL code, even though sqlalchemy doesn't prompt any error messages. I would like to find out an efficient and robust way of joining these tables the way I described. What would be the best solution given my concerns? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[sqlalchemy] Many to One using Different Modules
Hi, I am quite new to sqlalchemy. I am trying to implement a many-to-one relationship between classes in different modules. I was able to get this to work when classes are inside the same module however when I put the classes in different modules I get import errors. I made sure I used strings while referring to the keys. I was wondering if someone can give me some advice. lattice_definition.py: from sqlalchemy.orm import sessionmaker, relationship from setuptools.tests.test_resources import Metadata from sqlalchemy.orm import relationship,backref from sqlalchemy import ForeignKey from sqlalchemy.schema import PrimaryKeyConstraint from Irmis.model_definition import model class lattice(Base): __tablename__='lattice' lattice_id= Column(Integer, primary_key=True) machine_mode_id=Column(Integer,ForeignKey('machine_mode.machine_mode_id')) model_geometry_id=Column(Integer,ForeignKey('model_geometry.model_geometry_id')) model_line_id=Column(Integer,ForeignKey('model_line.model_line_id')) gold_lattices=relationship(gold_lattice) elements=relationship(element) model_definition.py: from sqlalchemy.orm import relationship,backref from sqlalchemy import ForeignKey from sqlalchemy.schema import PrimaryKeyConstraint from Irmis.lattice_definition import Base from Irmis.lattice_definition import lattice class model(Base): __tablename__='model' model_id=Column(Integer,primary_key=True) lattice_id=Column(Integer,ForeignKey(lattice.lattice_id)) Thanks, --Arman -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.