[sqlalchemy] strange serial problem in postgres
Hi all, i've added a new table recentli in main DB, but at first insertion have this problem: any time i try an insertion the sqlalchemy engine search nextval of a partial primary key. SQLError: (ProgrammingError) relation scadenziario_id_piano_seq does not exist 'select nextval(\'scadenziario_id_piano_seq\')' {} but the table is: CREATE TABLE scadenziario ( id_pianoINTEGER NOT NULL references piano(id), data_creazione DATE, data_programmataDATE NOT NULL, cod_verificaTEXT NOT NULL references verifica(codice) ON UPDATE CASCADE, ); How and why SQLAlchemy read a serial for the id_piano column ? Thank you Glauco -- ++ Glauco Uri - Programmatore glauco(at)allevatori.com Sfera Carta Software(r) [EMAIL PROTECTED] Via Bazzanese,69 Casalecchio di Reno(BO) - Tel. 051591054 ++ --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: large amount of insert
there was some recent thread on this 2-3 weeks ago, lookup.. On Friday 17 August 2007 11:28:34 Glauco wrote: What's is the best solution for a web procedure , in TurboGear, that produce a large amount of insert into ? (from 2000 to 2 insertions on a submit) i've done some try with somethink like 5000 insertion and the transaction is huge do you think sqlalchemy can do this better with some trick or is better to transfer all data in a copy from file? Thank you Glauco --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Join vs. 2 selects?
Hi all, This is sort of a general db question I was wondering about. So, I'm trying to write a small blog system (not using the mapper, only sql queries written on my own until now) and I am not sure: Say, I want to show one blog post and all the comments for that blog entry (one-to-many). I know the post_id (from the get-parameter of the request). Is it faster to do: a) 2 separate select-queries? One query going like: SELECT * from blog_posts WHERE post_id = my_post_id and the other sth. like SELECT * from comments WHERE parent_id = my_post_id. b) one join-query? Joining the two tables over my_post_id, so I only need 1 sql-query? I'd appreciate some help, since I don't have all that much db- experience. Cheers, Martin --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy 0.4 beta3 released
Hi, Any chance Ticket #731 get into 0.4 ? I'd prefer not relying on a patch if possible. Thanks a lot, Christophe --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Join vs. 2 selects?
Martin wrote: a) 2 separate select-queries? One query going like: SELECT * from blog_posts WHERE post_id = my_post_id and the other sth. like SELECT * from comments WHERE parent_id = my_post_id. b) one join-query? Joining the two tables over my_post_id, so I only need 1 sql-query? Two queries would take more time as the bottleneck will usually be the network. Communicating back and forth takes a while compared to CPU cycles. Usually, for performance, you should try to retrieve a maximum amount of data in one shot. I'm no database expert, anyone correct me if I'm wrong. Using the ORM part of SA, you would want to set your post mapper with a non-lazy relation: relation('comments', ..., lazy=False). When you'll query for a post, it will generate some SQL that will retrieve your post *and* it's comments all in one query. Set echo=True on your engine and you'll see the actual query. Anyway, all this is nicely documented... :) Regards, -- Alexandre CONRAD --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: strange serial problem in postgres
On Aug 17, 2007, at 4:21 AM, Glauco wrote: SQLError: (ProgrammingError) relation scadenziario_id_piano_seq does not exist 'select nextval(\'scadenziario_id_piano_seq\')' {} but the table is: CREATE TABLE scadenziario ( id_pianoINTEGER NOT NULL references piano(id), data_creazione DATE, data_programmataDATE NOT NULL, cod_verificaTEXT NOT NULL references verifica(codice) ON UPDATE CASCADE, ); How and why SQLAlchemy read a serial for the id_piano column ? try setting autoincrement=False on the id_piano Column object. but regardless, youll need to have a non-None value for inserts to this column. --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: strange serial problem in postgres
In Postgres at least, serial columns are typically defined as: CREATE TABLE FOO ( id_piano serial primary key, ... ) This automatically creates a sequence foo_id_piano_seq. Of course, you can also create a sequence separate from a table with CREATE SEQUENCE, but this is (IMHO) wordy. You can select from it to find the current value with CURRVAL(), or get the value and increment it in one operation as: SELECT NEXTVAL ( sequencename ); -- Kevin ___ Kevin J. Rice Senior Software Engineer, Textura LLC 51-K Sherwood Terrace, Lake Bluff IL ___ --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: strange serial problem in postgres
justanyone ha scritto: In Postgres at least, serial columns are typically defined as: CREATE TABLE FOO ( id_piano serial primary key, ... ) This automatically creates a sequence foo_id_piano_seq. Of course, you can also create a sequence separate from a table with CREATE SEQUENCE, but this is (IMHO) wordy. You can select from it to find the current value with CURRVAL(), or get the value and increment it in one operation as: SELECT NEXTVAL ( sequencename ); -- Kevin Thank you kevin , i've worked a lot over PG and this tecnique is consolidated in our model.. but here the problem is that the column is a simplycolumn_name INTEGER NOT NULL references other_table(id) and i cannot understand why sqlalchemy whant to use it as a column_name SERIAL Thank you Glauco -- ++ Glauco Uri - Programmatore glauco(at)allevatori.com Sfera Carta Software(r) [EMAIL PROTECTED] Via Bazzanese,69 Casalecchio di Reno(BO) - Tel. 051591054 ++ --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] sqlalchemy + django
Could someone please explain the following behaviour: from django.http import HttpResponseRedirect, Http404 from django.shortcuts import render_to_response from df.tst import Path as ThePath from sqlalchemy import * from sqlalchemy.orm import * metadata = MetaData() u_table = Table('auth_user', metadata, \ Column('id', Integer, primary_key=True), \ Column('username', String(30))) f_table = Table('fellowship_file', metadata, \ Column('id', Integer, primary_key=True), \ Column('user_id', None, ForeignKey(auth_user.id)), \ Column('ls', PickleType, nullable=False)) class User(object): pass class Path(ThePath): pass clear_mappers() mapper(User, u_table) mapper(Path, f_table) db = create_engine('...') metadata.create_all(db) context = create_session(bind=db) def ls(request, user=None): if not user: raise Http404 stuff = context.query(Path).filter(User.c.username==user).first() context.clear() context.close() return render_to_response('index.html', {'ls': stuff.id}) Traceback (most recent call last): File /usr/lib/python2.4/site-packages/django/core/handlers/base.py in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File /home/grey/src/df/fs/views.py in ls 37. stuff = context.query(Path).filter(User.c.username==user).first() File /usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py in first 920. ret = list(self[0:1]) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py in __iter__ 958. return iter(self.select_whereclause()) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py in select_whereclause 359. return self._select_statement(statement, params=params) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py in _select_statement 1072. return self.execute(statement, params=params, **kwargs) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py in execute 973. return self.instances(result, **kwargs) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py in instances 1032. self.select_mapper._instance(context, row, result) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py in _instance 1497. self.populate_instance(context, instance, row, identitykey, isnew) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py in populate_instance 1534. prop.execute(selectcontext, instance, row, identitykey, isnew) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/interfaces.py in execute 163. self._get_context_strategy(selectcontext).process_row(selectcontext, instance, row, identitykey, isnew) File /usr/lib/python2.4/site-packages/sqlalchemy/orm/strategies.py in process_row 39. instance.__dict__[self.key] = row[self.columns[0]] File /usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py in __getitem__ 1171. return self.__parent._get_col(self.__row, key) File /usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py in _get_col 993. return rec[1].convert_result_value(row[rec[2]], self.dialect) File /usr/lib/python2.4/site-packages/sqlalchemy/types.py in convert_result_value 323. return self.pickler.loads(str(buf)) AttributeError at /users/grey/ 'module' object has no attribute 'Path' P.S. This is working without django. P.P.S. Django community is assured that this problem is not related to django in any sense. --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy 0.4 beta3 released
Hi, Any chance Ticket #731 get into 0.4 ? I'd prefer not relying on a patch if possible. I'd applied this to trunk and rel_0_3. I don't have alert mails setup from trac (maybe I should) so if you drop me a mail when you want an MSSQL patch looking at, I'll do my best. Paul --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Join vs. 2 selects?
the traditional wisdom is that the join is faster, because you have fewer round trips to the database. particularly if you are loading many parent items each with many child items. if you are loading just a single parent item, the second SELECT to get its child items is not a very large hit at all, and some would argue that its more efficient to issue two single-table SELECTs rather than a join on two tables. But its not more efficient to issue 20 single-table SELECTs versus a join on two tables. a join increases the complexity on the database side, versus a single table select. so some architectures forego the usage of joins altogether (im talking large scale sites like del.icio.us and ebay)...but in those cases they have to have a plan in place to not issue tons of individual queries (i.e. lots of extra caching). this is why in SA we've tried to make it really easy to switch between the lazy and eager loading (i.e. using query.options()); its very dependent on what data you are selecting, and what data you need to see for the current operation. --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy + django
its a pickling error. Pickle is not managing to map your pickled data back to the correct module name from which to import the Path object.If this module (i.e., where the Path class originates) is run by django in some kind of dynamic importing scheme, that could definitely break pickle's ability to locate the originating module, depending on how its done. You might want to try using the pickle module instead of the default of cPickle, which ive observed is not as smart about module imports: import pickle Column('ls', PickleType(pickler=pickle), nullable=False) alternatively, define all the classes which you are pickling, i.e. Path etc., in a separate module which is defined in a traditional location thats importable by Python's own import statement. --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy + django
On 8/17/07, Michael Bayer [EMAIL PROTECTED] wrote: its a pickling error. Pickle is not managing to map your pickled data back to the correct module name from which to import the Path object.If this module (i.e., where the Path class originates) is run by django in some kind of dynamic importing scheme, that could definitely break pickle's ability to locate the originating module, depending on how its done. The 'Path' object is not related to django You might want to try using the pickle module instead of the default of cPickle, which ive observed is not as smart about module imports: import pickle Column('ls', PickleType(pickler=pickle), nullable=False) the same alternatively, define all the classes which you are pickling, i.e. Path etc., in a separate module which is defined in a traditional location thats importable by Python's own import statement. I've tried this : import psycopg2 ... s = curs.fetchone()[0] ls = cPickle.loads(str(s)) and it returned : AttributeError: 'module' object has no attribute 'Path' just as django did. it pretends that 'Path' is not defined. Seems it is still the problem of django Thanks. P.S. going to use cPickle without sqlalchemy to load data --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy 0.4 beta3 released
2007/8/17, Paul Johnston [EMAIL PROTECTED]: Hi, Any chance Ticket #731 get into 0.4 ? I'd prefer not relying on a patch if possible. I'd applied this to trunk and rel_0_3. I don't have alert mails setup from trac (maybe I should) so if you drop me a mail when you want an MSSQL patch looking at, I'll do my best. No problem, I'll do that next time :-) Thanks ! Christophe --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: large amount of insert
well at the very least you want to ensure that executemany() is being used for the inserts (i.e. with sqlalchemy, dont use ORM, use connection.execute(statement, [param, param, param...]). If you use SQLAlchemy's executemany() facilities, we've just increased their efficiency by about 60% in the 0.4.0beta3 release, we had some huge latency issues with this particular operation previously. faster still is to use raw DBAPI: conn = engine.connect() conn.connection.executemany(statement, [params...]) using copy from..file is probably very fast, but its a little weird to use that in the context of a web request. --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: strange serial problem in postgres
Glauco ha scritto: Thank you kevin , i've worked a lot over PG and this tecnique is consolidated in our model.. but here the problem is that the column is a simplycolumn_name INTEGER NOT NULL references other_table(id) and i cannot understand why sqlalchemy whant to use it as a column_name SERIAL Make that foreign key primary as well: INTEGER REFERENCES ... PRIMARY KEY Also, like Mike said, the autoload mechanism (or something below) infers that it's a serial column, you should turn that off with autoincrement=False in the Table constructor, where you autoload the schema. --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select
Lukasz Szybalski ha scritto: bind_meta_data() users_table = Table('users', metadata, autoload=True) class Users(object): pass usersmapper=mapper(Users,users_table) assign_mapper() in place of mapper() mysession=session.query(Users) 1. What would be the code from now on to query all Users? Does 'mysession' have a connection to a database already? Yes, if you used assign_mapper instead, your model's classes will be implicitly bound to the session context. So... 2. How do I select a user where User_Sid=100? What is the schema of the table? If User_Sid is the primary key: User.get(100) If it's not: User.select_by(User_Sid=100) Why doesn't this work? jj=[] for users in session.query(Users): jj.append(users.Users_Sid) ehm, weird use of plural for a loop variable. You are using an explicit session here, you don't need to do that in TurboGears since the classes have an implicit session bound to the request, that it cleaned after each served page. Anyway, it should work more or less (I note Users_Sid in place of User_sid) What is the simples way to query my database to get user with user_sid=100? What is the simples way to query my database to get user last_name='Smith' with user_sid=100? Again, are filtering by both last_name and user_sid? So I suppose user_sid is not the primary key after all. User.select_by(User_sid=100, last_name='Smith') --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select
hello - you generally use mapper() and relation() to set up how you'd like your classes to correspond to your table relationships. as far as compound keys, if they are defined with a primary key constraint you shouldn't have to worry about them. --- Ok. So we are using mapper() function to map a python class to a database. In my model.py I have #Initial import packages... from sqlalchemy import * from turbogears.database import metadata, session,bind_meta_data from sqlalchemy.ext.assignmapper import assign_mapper from sqlalchemy.ext.activemapper import * from turbogears import widgets, validators bind_meta_data() users_table = Table('users', metadata, autoload=True) class Users(object): pass usersmapper=mapper(Users,users_table) mysession=session.query(Users) 1. What would be the code from now on to query all Users? Does 'mysession' have a connection to a database already? 2. How do I select a user where User_Sid=100? Why doesn't this work? jj=[] for users in session.query(Users): jj.append(users.Users_Sid) What is the simples way to query my database to get user with user_sid=100? What is the simples way to query my database to get user last_name='Smith' with user_sid=100? Thanks, Lucas --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select
ok...correct me if I'm wrong. #we start by importing from turbogears.database import metadata, session,bind_meta_data from sqlalchemy.ext.assignmapper import assign_mapper from turbogears import widgets, validators import sqlalchemy #Then we bound to database bind_meta_data() #create a table object users_table = sqlalchemy.Table('users', metadata, autoload=True) or you can use: tables = [] for name in engine.execute(SHOW TABLES): tables[name] = sa.Table(name, metadata, autoload=True) Got another error here. but I guess its fixed in a newer version of sqlalchemy via ticket 482 File /usr/lib/python2.4/site-packages/sqlalchemy/databases/mysql.py, line 320, in reflecttable raise exceptions.NoSuchTableError(table.name) sqlalchemy.exceptions.NoSuchTableError: ('users',) Next... class Users(object): pass usersmapper=assign_mapper(Users,users_table) No need to create a session because: assign_mapper on TurboGears Is using SessionContext. Yes, if you used assign_mapper instead, your model's classes will be implicitly bound to the session context. put assign_mapper() in place of mapper() Are these two the same? assign_mapper in TG, is the same as mapper in SA? 2. How do I select a user where User_Sid=100? What is the schema of the table? User_Sid - Primary key, int first_name last_name If User_Sid is the primary key: User.get(100) If it's not: User.select_by(User_Sid=100) or User.select_by(User_sid=100, last_name='Smith') Ok, now I have the object for my User.get(100) query. quote.model.User object at 0x40f039ec I can display it by myuser=User.get(100) myuser.USERS_SID myuser.LAST myuser.FIRST How can I iterate through myuser fields? This doesn't work: for field in User.get(100): print field TypeError: iteration over non-sequence Thanks for the help. I have moved ahead in these few emails more then I was able in a week. Lucas --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Joining multiple tables
On 8/17/07, Michael Bayer [EMAIL PROTECTED] wrote: hi Vetle - the Table object supports a join() method, which can be called in a chain, i.e. table1.join(table2).join(table3)... if you need to specify the ON part of the join, its the second argument to join() (below illustrated with two joins back to table1): table1.join(table2, table1.c.id==table2.c.someid).join(table3, table1.c.id==table3.c.id) hope this helps... Yes thanks, it helped a little bit. I realized I could to this inside from_obj = [ ... ]. That, in addition to using table aliases. I ended up with something like: t1_2 = t1.alias('t1_2') select([t1, t1.c.a ], from_obj = [t1.join(t1_2, t1.c.a = t1_2.c.b).join(.)] It was kinda complicated, and the schema could have been designed a little differently, but I got it working at last. ;) -- Vetle Roeim --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy + django
On Aug 17, 11:54 am, Vitaliyi [EMAIL PROTECTED] wrote: I've tried this : import psycopg2 ... s = curs.fetchone()[0] ls = cPickle.loads(str(s)) and it returned : AttributeError: 'module' object has no attribute 'Path' just as django did. it pretends that 'Path' is not defined. Seems it is still the problem of django Thanks. P.S. going to use cPickle without sqlalchemy to load data the data coming back from your database is just a string. using psycopg2/sqlalchemy or nothing to produce that string before sending to pickle.loads() should not affect the equation. I understand that Path is not part of django, but i was suggesting that if the module where Path resides is *imported* by django using a reloadable container of some kind, that could break pickle's ability to re-locate the object. I suggest this because you say it worked *without* django. also i have no idea how django loads modules, but from my own work with mod_python as well as Myghty and Mako i know that reloadable module schemes are important in web frameworks so that changes to controller modules show up immediately in the application without restarting. --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---