Re: [DataMapper] non-existent `id` column thrown in every get query/join

2013-01-12 Thread Jeff Ruhl
It generated the same query

On Thursday, January 10, 2013 9:48:34 PM UTC-6, Abe Voelker wrote:
>
> Any different result if you get rid of the Serial type?
>
> property :id, Integer, :field => 'post_id', :key => true
>
>
> On Thursday, January 10, 2013 6:01:44 PM UTC-6, Jeff Ruhl wrote:
>>
>> It's now querying for `id` 3 times.
>> Resulting sql
>>
>> SELECT `post_id`, `id`, `username`, `date`, `id`, `id` FROM `xf_post` 
>> WHERE `post_id` = 1 LIMIT 1
>>
>>
>> On Thursday, November 15, 2012 3:55:44 AM UTC-6, André Lima wrote:
>>>
>>> Jeff,
>>>
>>> Remove :key => true ( this is used only if the field is different of 
>>> Serial )
>>>
>>> Andre Lima
>>>
>>> On 14/11/2012, at 23:20, Jeff Ruhl  wrote:
>>>
>>> Given the following class
>>>
>>> class Post
>>>include DataMapper::Resource
>>>
>>>property :id, Serial, :field => 'post_id', :key => true
>>>property :thread_id, Integer
>>>property :username, String
>>>property :post_date, Integer
>>>property :message, Text
>>>
>>> end
>>>
>>>  
>>> executing 'Post.get(1)' produces the following sql
>>>
>>> SELECT `post_id`, `id`, `username`, `date`, `id`, `id` FROM `xf_post` 
>>> WHERE `post_id` = 1 LIMIT 1
>>>
>>>
>>> I've also tried changing the :id property name to all forms of insanity, 
>>> but DataMapper keeps tacking the `id` column in the queries.
>>> Is there a configuration somewhere to turn off assuming an id column? 
>>> I'm mapping over a legacy database. 
>>>  
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "DataMapper" group.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msg/datamapper/-/456dN_dlh9wJ.
>>> To post to this group, send email to datam...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> datamapper+...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/datamapper?hl=en.
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/datamapper/-/rNrZ84mWX5YJ.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.



Re: [DataMapper] non-existent `id` column thrown in every get query/join

2013-01-10 Thread Abe Voelker
Any different result if you get rid of the Serial type?

property :id, Integer, :field => 'post_id', :key => true


On Thursday, January 10, 2013 6:01:44 PM UTC-6, Jeff Ruhl wrote:
>
> It's now querying for `id` 3 times.
> Resulting sql
>
> SELECT `post_id`, `id`, `username`, `date`, `id`, `id` FROM `xf_post` 
> WHERE `post_id` = 1 LIMIT 1
>
>
> On Thursday, November 15, 2012 3:55:44 AM UTC-6, André Lima wrote:
>>
>> Jeff,
>>
>> Remove :key => true ( this is used only if the field is different of 
>> Serial )
>>
>> Andre Lima
>>
>> On 14/11/2012, at 23:20, Jeff Ruhl  wrote:
>>
>> Given the following class
>>
>> class Post
>>include DataMapper::Resource
>>
>>property :id, Serial, :field => 'post_id', :key => true
>>property :thread_id, Integer
>>property :username, String
>>property :post_date, Integer
>>property :message, Text
>>
>> end
>>
>>  
>> executing 'Post.get(1)' produces the following sql
>>
>> SELECT `post_id`, `id`, `username`, `date`, `id`, `id` FROM `xf_post` 
>> WHERE `post_id` = 1 LIMIT 1
>>
>>
>> I've also tried changing the :id property name to all forms of insanity, 
>> but DataMapper keeps tacking the `id` column in the queries.
>> Is there a configuration somewhere to turn off assuming an id column? I'm 
>> mapping over a legacy database. 
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "DataMapper" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/datamapper/-/456dN_dlh9wJ.
>> To post to this group, send email to datam...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> datamapper+...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/datamapper?hl=en.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/datamapper/-/-DEfvHIeHhgJ.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.



Re: [DataMapper] non-existent `id` column thrown in every get query/join

2013-01-10 Thread Jeff Ruhl
It's now querying for `id` 3 times.
Resulting sql

SELECT `post_id`, `id`, `username`, `date`, `id`, `id` FROM `xf_post` WHERE 
`post_id` = 1 LIMIT 1


On Thursday, November 15, 2012 3:55:44 AM UTC-6, André Lima wrote:
>
> Jeff,
>
> Remove :key => true ( this is used only if the field is different of 
> Serial )
>
> Andre Lima
>
> On 14/11/2012, at 23:20, Jeff Ruhl > wrote:
>
> Given the following class
>
> class Post
>include DataMapper::Resource
>
>property :id, Serial, :field => 'post_id', :key => true
>property :thread_id, Integer
>property :username, String
>property :post_date, Integer
>property :message, Text
>
> end
>
>  
> executing 'Post.get(1)' produces the following sql
>
> SELECT `post_id`, `id`, `username`, `date`, `id`, `id` FROM `xf_post` 
> WHERE `post_id` = 1 LIMIT 1
>
>
> I've also tried changing the :id property name to all forms of insanity, 
> but DataMapper keeps tacking the `id` column in the queries.
> Is there a configuration somewhere to turn off assuming an id column? I'm 
> mapping over a legacy database. 
>  
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/datamapper/-/456dN_dlh9wJ.
> To post to this group, send email to datam...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> datamapper+...@googlegroups.com .
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/datamapper/-/RWGIObv1eXMJ.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.



Re: [DataMapper] non-existent `id` column thrown in every get query/join

2012-11-15 Thread Andre Lima
Jeff,

Remove :key => true ( this is used only if the field is different of Serial )

Andre Lima

On 14/11/2012, at 23:20, Jeff Ruhl  wrote:

> Given the following class
> 
> class Post
>include DataMapper::Resource
> 
>property :id, Serial, :field => 'post_id', :key => true
>property :thread_id, Integer
>property :username, String
>property :post_date, Integer
>property :message, Text
> 
> end
>  
> executing 'Post.get(1)' produces the following sql
> 
> SELECT `post_id`, `id`, `username`, `date`, `id`, `id` FROM `xf_post` WHERE 
> `post_id` = 1 LIMIT 1
> 
> I've also tried changing the :id property name to all forms of insanity, but 
> DataMapper keeps tacking the `id` column in the queries.
> Is there a configuration somewhere to turn off assuming an id column? I'm 
> mapping over a legacy database. 
>  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/datamapper/-/456dN_dlh9wJ.
> To post to this group, send email to datamapper@googlegroups.com.
> To unsubscribe from this group, send email to 
> datamapper+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.