Re: [sqlalchemy] how can i get .engine.execute result?

2014-07-03 Thread 'Frank Liou' via sqlalchemy
> Hi Simon thanks for your answer but i can't understand what's "fetchall()" mean i remove the " fetchall()" it still work -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from

Re: [sqlalchemy] Automatically set cascade settings based on "ON DELETE" / "ON UPDATE" when reflecting?

2014-07-03 Thread Paul Molodowitch
I wasn't advocating making this connection "in general" (though I like the autoconfigure option!), but only specifically for the case of reflection - in this case, we know the DB supports it, and it would result in a better python interface to the already existing tables. On Thu, Jul 3, 2014 at 3

Re: [sqlalchemy] Automatically set cascade settings based on "ON DELETE" / "ON UPDATE" when reflecting?

2014-07-03 Thread Mike Bayer
On 7/3/14, 6:15 PM, Mike Bayer wrote: > On 7/3/14, 5:45 PM, Paul Molodowitch wrote: >> I noticed that sqlalchemy now properly sets the onpudate / ondelete >> properties of foreign keys when reflecting tables: >> >> https://bitbucket.org/zzzeek/sqlalchemy/issue/2183/support-on-delete-update-in-fore

Re: [sqlalchemy] Automatically set cascade settings based on "ON DELETE" / "ON UPDATE" when reflecting?

2014-07-03 Thread Mike Bayer
On 7/3/14, 5:45 PM, Paul Molodowitch wrote: > I noticed that sqlalchemy now properly sets the onpudate / ondelete > properties of foreign keys when reflecting tables: > > https://bitbucket.org/zzzeek/sqlalchemy/issue/2183/support-on-delete-update-in-foreign-key > > However, it doesn't seem to set

[sqlalchemy] Automatically set cascade settings based on "ON DELETE" / "ON UPDATE" when reflecting?

2014-07-03 Thread Paul Molodowitch
I noticed that sqlalchemy now properly sets the onpudate / ondelete properties of foreign keys when reflecting tables: https://bitbucket.org/zzzeek/sqlalchemy/issue/2183/support-on-delete-update-in-foreign-key However, it doesn't seem to set the cascade properties of relationships to reflect th

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread trustedbox
Muchos grasias, Michael! Issue resolved. There were a couple of other ForeignKey issues, seems to be okay now. So far I understand that there is a lot to learn for me, so I was wondering - do you by chance accept apprentices ? I would be willing to help writing fixes/minor features whatever for

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread Mike Bayer
OK thats great but you have a long way to go: import cycle: classic$ .venv/bin/python Python 2.7.5 (default, Mar 7 2014, 19:17:16) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import model Traceback (m

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-07-03 Thread Mike Bayer
this works fine for me: def upgrade(): mytype = ENUM('a', 'b', 'c', create_type=False, name='myenum') mytype.create(op.get_bind(), checkfirst=False) op.create_table('t1', sa.Column('id', sa.Integer(), nullable=False), sa.Column('col1', mytype) ) op.create_ta

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread trustedbox
Hi Mike! I've updated requirements. Let me check if I didn't commit something. четверг, 3 июля 2014 г., 20:41:55 UTC+3 пользователь Michael Bayer написал: > > to start with, you have an import cycle. fix that first. > > classics-MacBook-Pro-2:artFlask classic$ .venv/bin/python > Python 2.7.5 (d

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-07-03 Thread Anton
Hey guys, I am facing the same issue, I am using PostgreSQL and want to use native ENUM type in two tables. For migration I am going to use alembic. Did you guys find out any was to do this? Thanks, Anton On Thursday, May 1, 2014 10:33:21 AM UTC-7, Michael Bayer wrote: > > OK. ENUM is somethi

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread Mike Bayer
this project needs: 1. a package 2. a setup.py file 3. a requirements.txt file I am running in each dependency indivdually as I get import errors. very painful. On 7/3/14, 1:19 PM, trusted...@gmail.com wrote: > Mike, here is the source for the models: > https://github.com/ArtAPI/artFlask/

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread Mike Bayer
to start with, you have an import cycle. fix that first. classics-MacBook-Pro-2:artFlask classic$ .venv/bin/python Python 2.7.5 (default, Mar 7 2014, 19:17:16) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type "help", "copyright", "credits" or "license" for more information. >

Re: [sqlalchemy] Automatically set primary key to None when deleted?

2014-07-03 Thread Paul Molodowitch
> > Particularly since sqlalchemy has already established that it's willing to > expire dict members when they may not be valid anymore - ie, what it does > to clear any "cached" values from a row proxy after the session is > committed. > > well it doesn't expire the deleted object right now becaus

Re: [sqlalchemy] Automatically set primary key to None when deleted?

2014-07-03 Thread Mike Bayer
On 7/3/14, 1:01 PM, Paul Molodowitch wrote: > > > That makes sense... but if if it really means nothing, and we > shouldn't be looking at it, then why keep it's attributes around at all? because it is an additional step to actually erase the attributes and just hadn't been considered. > Particu

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread trustedbox
Mike, here is the source for the models: https://github.com/ArtAPI/artFlask/blob/refactoring/model/__init__.py I would really apprieciate your feedback on this, I'm really new to flask and SQLAlchemy. The other source files (artList.py etc) are also there. Thank you, Andrey четверг, 3 июля 2014

Re: [sqlalchemy] Automatically set primary key to None when deleted?

2014-07-03 Thread Paul Molodowitch
On Wed, Jul 2, 2014 at 9:22 PM, Mike Bayer wrote: > > On 7/2/14, 10:05 PM, Paul Molodowitch wrote: > > Suppose I have a super simple table like this: > > class Dinosaur(Base): > __tablename__ = 'dinosaurs' > id = Column(Integer, primary_key=True) > name = Column(String(255)) > >

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread trustedbox
Adding import instruction to artList.py didn't seem to help: from model import Artwork, Person What else can I do ? четверг, 3 июля 2014 г., 17:33:09 UTC+3 пользователь Michael Bayer написал: > > > On 7/3/14, 3:23 AM, trust...@gmail.com wrote: > > Hi, Michael, > > > > here is the stack trace:

[sqlalchemy] @as_declarative() weirdness

2014-07-03 Thread Roland van Laar
Hello, I'm trying to override __new__ method on the declarative base. Calling super(Base, cls).__new__ actually calls itself. Something is happening with the mro, but I'm not quite sure what and how to proceed. At the bottom of this email is a small example that demonstrates the problem. Rega

[sqlalchemy] can I have update_all in sqlalchemy

2014-07-03 Thread Atul Motade
HI I am using pyramid framework with sqlalchemy , I want to update 100 different column with different values. is there any function available like add_all to update a table(ex update_all ) in sqlalchemy. -- You received this message because you are subscribed to the Google Groups "sqlalchemy

Re: [sqlalchemy] how to query one-to-many relationships, in a complicated way?

2014-07-03 Thread Mike Bayer
On 7/2/14, 9:24 AM, Chung WONG wrote: > Hi list, > > For this problem I am even having trouble think of a proper subject > for it. > I try my best to express as clear as possible and sorry for any > confusions. > > Say there are three classes with relationship defined as below: > class User(Base)

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread Mike Bayer
On 7/3/14, 3:23 AM, trusted...@gmail.com wrote: > Hi, Michael, > > here is the stack trace: > File "/home/andrey/projects/art/artFlask/api/artList.py", line 30, > in post > item = app_ctx.create_item_from_context() > File "/home/andrey/projects/art/artFlask/utils/app_ctx.py", line 53, > in

Re: [sqlalchemy] defaultdict functionality for association proxies

2014-07-03 Thread Brian Findlay
Ok, Mike. Thanks. Ended up removing the trigger from the model and pushing that code to the controller, so that "foo" updates the "bar" attribute after form data with UserCourse objects is handled. On Wednesday, July 2, 2014 9:42:11 PM UTC-4, Michael Bayer wrote: > > > On 7/2/14, 2:59 PM, Bria

Re: [sqlalchemy] how can i get .engine.execute result?

2014-07-03 Thread Simon King
On Thu, Jul 3, 2014 at 8:48 AM, 'Frank Liou' via sqlalchemy wrote: > def get_query(): > conn = engine.connect() > check = 'SELECT * FROM friends' > obj = [conn.execute(check)] > jqs = json.dumps(obj) > return jqs > > > > result is > > Internal Server Error > > The server encoun

[sqlalchemy] how can i get .engine.execute result?

2014-07-03 Thread 'Frank Liou' via sqlalchemy
def get_query(): conn = engine.connect() check = 'SELECT * FROM friends' obj = [conn.execute(check)] jqs = json.dumps(obj) return jqs result is Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is ov

Re: [sqlalchemy] "failed to locate a name" error when using model with relationship

2014-07-03 Thread trustedbox
Hi, Michael, here is the stack trace: File "/home/andrey/projects/art/artFlask/api/artList.py", line 30, in post item = app_ctx.create_item_from_context() File "/home/andrey/projects/art/artFlask/utils/app_ctx.py", line 53, in create_item_from_context item = ModelClass(**data) File