Re: [web2py] invalid table/column name "comment"

2013-07-22 Thread Jeremy Hankenson
Thank you!

This explains why when I created a separate model file it worked just fine, 
cause I didn't include that check_reserved argument.  

On Monday, July 22, 2013 4:39:23 AM UTC-5, Marin Pranjić wrote:
>
> It's not mysql comment, but DAL is written so it works with a lot of 
> databases. This could stop you from moving to another database engine later.
> If you want to turn it off, just edit your db.py file and remove 
> check_reserved argument from your DAL(...) init call.
> I'd rather change column name - but this is just my preference. I like 
> this check for reserved keywords :)
>
> Note, you can use check_reserved=['mysql'] etc
>
> Marin
>
>
> On Mon, Jul 22, 2013 at 10:32 AM, Jeremy Hankenson 
> 
> > wrote:
>
>> Interesting problem I've encountered. 
>>
>> I'm getting the error: * invalid 
>> table/column name "comment" is a "ALL" reserved SQL/NOSQL keyword*
>> *
>> *
>> after defining my tables as such: 
>> # define tables for blog posts
>> db.define_table('post',
>> Field('title', unique=True),
>> Field('body', 'text'),
>> format = '%(title)s')
>>
>> # define tables for comments on a blog post
>> db.define_table('comment',
>> Field('post_id', 'reference post'),
>> Field('author'),
>> Field('email'),
>> Field('body', 'text'))
>>
>>
>> db.post.title.requires = IS_NOT_IN_DB(db, db.post.title)
>> db.post.body.requires = IS_NOT_EMPTY()
>>
>> db.comment.post_id.requires = IS_IN_DB(db, db.post.id, '%(title)s')
>> db.comment.author.requires = IS_NOT_EMPTY()
>> db.comment.email.requires = IS_EMAIL()
>> db.comment.body.requires = IS_NOT_EMPTY()
>>
>>
>> Comment isn't a reserved keyword by mysql from what I have looked up. 
>> I've tried to look this up in google and got nowhere, so here I am again. xD
>>
>> Currently self-teaching myself python and web2py and do plan to pay it 
>> forward to open-source in the future and all help is appreciated in advance!
>> -Jeremy
>>
>> -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] invalid table/column name "comment"

2013-07-22 Thread Marin Pranjić
It's not mysql comment, but DAL is written so it works with a lot of
databases. This could stop you from moving to another database engine later.
If you want to turn it off, just edit your db.py file and remove
check_reserved argument from your DAL(...) init call.
I'd rather change column name - but this is just my preference. I like this
check for reserved keywords :)

Note, you can use check_reserved=['mysql'] etc

Marin


On Mon, Jul 22, 2013 at 10:32 AM, Jeremy Hankenson <
hankensonjer...@gmail.com> wrote:

> Interesting problem I've encountered.
>
> I'm getting the error: * invalid
> table/column name "comment" is a "ALL" reserved SQL/NOSQL keyword*
> *
> *
> after defining my tables as such:
> # define tables for blog posts
> db.define_table('post',
> Field('title', unique=True),
> Field('body', 'text'),
> format = '%(title)s')
>
> # define tables for comments on a blog post
> db.define_table('comment',
> Field('post_id', 'reference post'),
> Field('author'),
> Field('email'),
> Field('body', 'text'))
>
>
> db.post.title.requires = IS_NOT_IN_DB(db, db.post.title)
> db.post.body.requires = IS_NOT_EMPTY()
>
> db.comment.post_id.requires = IS_IN_DB(db, db.post.id, '%(title)s')
> db.comment.author.requires = IS_NOT_EMPTY()
> db.comment.email.requires = IS_EMAIL()
> db.comment.body.requires = IS_NOT_EMPTY()
>
>
> Comment isn't a reserved keyword by mysql from what I have looked up. I've
> tried to look this up in google and got nowhere, so here I am again. xD
>
> Currently self-teaching myself python and web2py and do plan to pay it
> forward to open-source in the future and all help is appreciated in advance!
> -Jeremy
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] invalid table/column name "comment"

2013-07-22 Thread Jeremy Hankenson
Interesting problem I've encountered. 

I'm getting the error: * invalid 
table/column name "comment" is a "ALL" reserved SQL/NOSQL keyword*
*
*
after defining my tables as such: 
# define tables for blog posts
db.define_table('post',
Field('title', unique=True),
Field('body', 'text'),
format = '%(title)s')

# define tables for comments on a blog post
db.define_table('comment',
Field('post_id', 'reference post'),
Field('author'),
Field('email'),
Field('body', 'text'))


db.post.title.requires = IS_NOT_IN_DB(db, db.post.title)
db.post.body.requires = IS_NOT_EMPTY()

db.comment.post_id.requires = IS_IN_DB(db, db.post.id, '%(title)s')
db.comment.author.requires = IS_NOT_EMPTY()
db.comment.email.requires = IS_EMAIL()
db.comment.body.requires = IS_NOT_EMPTY()


Comment isn't a reserved keyword by mysql from what I have looked up. I've 
tried to look this up in google and got nowhere, so here I am again. xD

Currently self-teaching myself python and web2py and do plan to pay it 
forward to open-source in the future and all help is appreciated in advance!
-Jeremy

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.