librelist archives

« back to archive

[Fwd: Friendly query error]

[Fwd: Friendly query error]

From:
Le Van
Date:
2010-02-25 @ 10:50

      
        

Re: [friendly] [Fwd: Friendly query error]

From:
Arun Thampi
Date:
2010-02-25 @ 11:02
Hi Van - I don't see the first error that you describe (I ran the same steps
as the instructions on the friendlyorm.com site) but the #find method for
Friendly documents is only used to find by ID (which is a UUID, something
which looks like this: "3c546520-042a-012d-1d9d-001b63387ea5", so
BlogPost.find("3c546520-042a-012d-1d9d-001b63387ea5") is a valid statement).
After you save a document to the database and retrieve it, when you call the
#id.to_guid method on the document, it will give you a string representation
of the ID of your document.

  Not sure of the first error though, any other details - are you using
MySQL or Postgres? You've confirmed that the tables exist (although the
absence of tables should throw another error)?

HTH.

Cheers,
Arun

On Thu, Feb 25, 2010 at 6:50 PM, Le Van <van.le@vn.pyramid-consulting.com>wrote:

>
>
>
> ---------- Forwarded message ----------
> From: Le Van <van.le@vn.pyramid-consulting.com>
> To: friendly@librelist.com
> Date: Thu, 25 Feb 2010 17:33:07 +0700
> Subject: Friendly query error
>  Hi,
> I am trying to use friendly by following the guidance from
> http://friendlyorm.com/.
>
> At step Query,
> BlogPost.all(:author => "James Golick")
>
> I got error:
> *Sequel::Error: Invalid operator =
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/sql.rb:140:in
> `initialize'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:26:in
> `new'
> *
> I tried another query:
>
> BlogPost.find("james")
>
> I got error:
> *Friendly::UUID::TypeError: Expected "van" to cast to a Friendly::UUID
> (invalid bytecount)
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:32:in
> `initialize'
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> `new'
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> `convert_ids_to_uuids'
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
> `initialize'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> `new'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> `query'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
> `first'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
> `find'
>
> *I tried another query:
>
> BlogPost.find(:author=>"james")
>
> I got error:
> *Friendly::UUID::TypeError: Expected {:author=>"van"} to cast to a
> Friendly::UUID (unknown source class)
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:58:in
> `initialize'
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> `new'
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> `convert_ids_to_uuids'
>     from
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
> `initialize'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> `new'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> `query'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
> `first'
>     from
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
> `find'
> *
> Could you explain me these error message?
>
> Thanks,
> Van
>
>


-- 
It's better to be a pirate than join the Navy - Steve Jobs
http://mclov.in

Re: [friendly] [Fwd: Friendly query error]

From:
Le Van
Date:
2010-02-25 @ 11:18
Hi Arun,
Thank for your quick reply.
I'm using Mysql 5.1, Karmic. As you can see the error log, I'm using 
friendly-0.5.1.
The database and tables also created.
The first error is weird.
The second error is my fault. I should try to use "first" instead. But 
calling first got the same error as calling 'all'.
One question: In my db, the uuid is in the form of "Ìå ,!Tߔ†Y
TáÚ"
Is it wrong compare to "3c546520-042a-012d-1d9d-001b63387ea5" ?
My db charset is UTF-8 also.
Thanks again,
Van
Arun Thampi wrote:
> Hi Van - I don't see the first error that you describe (I ran the same 
> steps as the instructions on the friendlyorm.com 
> <http://friendlyorm.com> site) but the #find method for Friendly 
> documents is only used to find by ID (which is a UUID, something which 
> looks like this: "3c546520-042a-012d-1d9d-001b63387ea5", so 
> BlogPost.find("3c546520-042a-012d-1d9d-001b63387ea5") is a valid 
> statement). After you save a document to the database and retrieve it, 
> when you call the #id.to_guid method on the document, it will give you 
> a string representation of the ID of your document.
>
>   Not sure of the first error though, any other details - are you 
> using MySQL or Postgres? You've confirmed that the tables exist 
> (although the absence of tables should throw another error)?
>
> HTH.
>
> Cheers,
> Arun
>
> On Thu, Feb 25, 2010 at 6:50 PM, Le Van 
> <van.le@vn.pyramid-consulting.com 
> <mailto:van.le@vn.pyramid-consulting.com>> wrote:
>
>
>
>
>     ---------- Forwarded message ----------
>     From: Le Van <van.le@vn.pyramid-consulting.com
>     <mailto:van.le@vn.pyramid-consulting.com>>
>     To: friendly@librelist.com <mailto:friendly@librelist.com>
>     Date: Thu, 25 Feb 2010 17:33:07 +0700
>     Subject: Friendly query error
>     Hi,
>     I am trying to use friendly by following the guidance from
>     http://friendlyorm.com/.
>
>     At step Query,
>     |||BlogPost.all(||:author| |=> ||"James Golick"||)|
>
>     I got error:
>     /Sequel::Error: Invalid operator =
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/sql.rb:140:in
>     `initialize'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:26:in
>     `new'
>     /
>     I tried another query:
>
>     |||BlogPost.find(||"james")
>
>     |I got error:
>     /Friendly::UUID::TypeError: Expected "van" to cast to a
>     Friendly::UUID (invalid bytecount)
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:32:in
>     `initialize'
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>     `new'
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>     `convert_ids_to_uuids'
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
>     `initialize'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>     `new'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>     `query'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
>     `first'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
>     `find'
>
>     /I tried another query:
>
>     |||BlogPost.find(||:author=>"james")
>
>     |I got error:
>     /Friendly::UUID::TypeError: Expected {:author=>"van"} to cast to a
>     Friendly::UUID (unknown source class)
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:58:in
>     `initialize'
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>     `new'
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>     `convert_ids_to_uuids'
>         from
>     /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
>     `initialize'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>     `new'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>     `query'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
>     `first'
>         from
>     
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
>     `find'
>     /
>     Could you explain me these error message?
>
>     Thanks,
>     Van
>
>
>
>
> -- 
> It's better to be a pirate than join the Navy - Steve Jobs
> http://mclov.in

Re: [friendly] [Fwd: Friendly query error]

From:
Arun Thampi
Date:
2010-02-25 @ 11:28
On Thu, Feb 25, 2010 at 7:18 PM, Le Van <van.le@vn.pyramid-consulting.com>wrote:

> Hi Arun,
> Thank for your quick reply.
> I'm using Mysql 5.1, Karmic. As you can see the error log, I'm using
> friendly-0.5.1.
> The database and tables also created.
> The first error is weird.
> The second error is my fault. I should try to use "first" instead. But
> calling first got the same error as calling 'all'.
>

Hmm strange, have not seen anything like that error before. I also use 5.1
with my charset set as UTF-8. Is that the entire error stacktrace? Can you
paste the full error (including where in Friendly the error is being
caused)?


> One question: In my db, the uuid is in the form of "Ìå ,!T ß”†Y T áÚ"
> Is it wrong compare to "3c546520-042a-012d-1d9d-001b63387ea5" ?
>

No, Friendly stores UUID's in 16-byte binary form and not string form, so it
is normal to see that output. For more, you can look
at ./lib/friendly/uuid.rb (Friendly::UUID class) under the friendly repo.


> My db charset is UTF-8 also.
> Thanks again,
> Van
> Arun Thampi wrote:
> > Hi Van - I don't see the first error that you describe (I ran the same
> > steps as the instructions on the friendlyorm.com
> > <http://friendlyorm.com> site) but the #find method for Friendly
> > documents is only used to find by ID (which is a UUID, something which
> > looks like this: "3c546520-042a-012d-1d9d-001b63387ea5", so
> > BlogPost.find("3c546520-042a-012d-1d9d-001b63387ea5") is a valid
> > statement). After you save a document to the database and retrieve it,
> > when you call the #id.to_guid method on the document, it will give you
> > a string representation of the ID of your document.
> >
> >   Not sure of the first error though, any other details - are you
> > using MySQL or Postgres? You've confirmed that the tables exist
> > (although the absence of tables should throw another error)?
> >
> > HTH.
> >
> > Cheers,
> > Arun
> >
> > On Thu, Feb 25, 2010 at 6:50 PM, Le Van
> > <van.le@vn.pyramid-consulting.com
> > <mailto:van.le@vn.pyramid-consulting.com>> wrote:
> >
> >
> >
> >
> >     ---------- Forwarded message ----------
> >     From: Le Van <van.le@vn.pyramid-consulting.com
> >     <mailto:van.le@vn.pyramid-consulting.com>>
> >     To: friendly@librelist.com <mailto:friendly@librelist.com>
> >     Date: Thu, 25 Feb 2010 17:33:07 +0700
> >     Subject: Friendly query error
> >     Hi,
> >     I am trying to use friendly by following the guidance from
> >     http://friendlyorm.com/.
> >
> >     At step Query,
> >     |||BlogPost.all(||:author| |=> ||"James Golick"||)|
> >
> >     I got error:
> >     /Sequel::Error: Invalid operator =
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/sql.rb:140:in
> >     `initialize'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:26:in
> >     `new'
> >     /
> >     I tried another query:
> >
> >     |||BlogPost.find(||"james")
> >
> >     |I got error:
> >     /Friendly::UUID::TypeError: Expected "van" to cast to a
> >     Friendly::UUID (invalid bytecount)
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:32:in
> >     `initialize'
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> >     `new'
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> >     `convert_ids_to_uuids'
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
> >     `initialize'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> >     `new'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> >     `query'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
> >     `first'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
> >     `find'
> >
> >     /I tried another query:
> >
> >     |||BlogPost.find(||:author=>"james")
> >
> >     |I got error:
> >     /Friendly::UUID::TypeError: Expected {:author=>"van"} to cast to a
> >     Friendly::UUID (unknown source class)
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:58:in
> >     `initialize'
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> >     `new'
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
> >     `convert_ids_to_uuids'
> >         from
> >
> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
> >     `initialize'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> >     `new'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
> >     `query'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
> >     `first'
> >         from
> >
> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
> >     `find'
> >     /
> >     Could you explain me these error message?
> >
> >     Thanks,
> >     Van
> >
> >
> >
> >
> > --
> > It's better to be a pirate than join the Navy - Steve Jobs
> > http://mclov.in
>
>
>


-- 
It's better to be a pirate than join the Navy - Steve Jobs
http://mclov.in

Re: [friendly] [Fwd: Friendly query error]

From:
James Golick
Date:
2010-02-25 @ 18:26
Can you repeat these bugs in an irb session and gist *all* of the output
from that session please?

- James

On Thu, Feb 25, 2010 at 3:28 AM, Arun Thampi <arun.thampi@gmail.com> wrote:

>
>
> On Thu, Feb 25, 2010 at 7:18 PM, Le Van <van.le@vn.pyramid-consulting.com>wrote:
>
>> Hi Arun,
>> Thank for your quick reply.
>> I'm using Mysql 5.1, Karmic. As you can see the error log, I'm using
>> friendly-0.5.1.
>> The database and tables also created.
>> The first error is weird.
>> The second error is my fault. I should try to use "first" instead. But
>> calling first got the same error as calling 'all'.
>>
>
> Hmm strange, have not seen anything like that error before. I also use 5.1
> with my charset set as UTF-8. Is that the entire error stacktrace? Can you
> paste the full error (including where in Friendly the error is being
> caused)?
>
>
>> One question: In my db, the uuid is in the form of "Ìå ,!T ß”†Y T áÚ"
>> Is it wrong compare to "3c546520-042a-012d-1d9d-001b63387ea5" ?
>>
>
> No, Friendly stores UUID's in 16-byte binary form and not string form, so
> it is normal to see that output. For more, you can look
> at ./lib/friendly/uuid.rb (Friendly::UUID class) under the friendly repo.
>
>
>> My db charset is UTF-8 also.
>> Thanks again,
>> Van
>> Arun Thampi wrote:
>> > Hi Van - I don't see the first error that you describe (I ran the same
>> > steps as the instructions on the friendlyorm.com
>> > <http://friendlyorm.com> site) but the #find method for Friendly
>> > documents is only used to find by ID (which is a UUID, something which
>> > looks like this: "3c546520-042a-012d-1d9d-001b63387ea5", so
>> > BlogPost.find("3c546520-042a-012d-1d9d-001b63387ea5") is a valid
>> > statement). After you save a document to the database and retrieve it,
>> > when you call the #id.to_guid method on the document, it will give you
>> > a string representation of the ID of your document.
>> >
>> >   Not sure of the first error though, any other details - are you
>> > using MySQL or Postgres? You've confirmed that the tables exist
>> > (although the absence of tables should throw another error)?
>> >
>> > HTH.
>> >
>> > Cheers,
>> > Arun
>> >
>> > On Thu, Feb 25, 2010 at 6:50 PM, Le Van
>> > <van.le@vn.pyramid-consulting.com
>> > <mailto:van.le@vn.pyramid-consulting.com>> wrote:
>> >
>> >
>> >
>> >
>> >     ---------- Forwarded message ----------
>> >     From: Le Van <van.le@vn.pyramid-consulting.com
>> >     <mailto:van.le@vn.pyramid-consulting.com>>
>> >     To: friendly@librelist.com <mailto:friendly@librelist.com>
>> >     Date: Thu, 25 Feb 2010 17:33:07 +0700
>> >     Subject: Friendly query error
>> >     Hi,
>> >     I am trying to use friendly by following the guidance from
>> >     http://friendlyorm.com/.
>> >
>> >     At step Query,
>> >     |||BlogPost.all(||:author| |=> ||"James Golick"||)|
>> >
>> >     I got error:
>> >     /Sequel::Error: Invalid operator =
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/sql.rb:140:in
>> >     `initialize'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:26:in
>> >     `new'
>> >     /
>> >     I tried another query:
>> >
>> >     |||BlogPost.find(||"james")
>> >
>> >     |I got error:
>> >     /Friendly::UUID::TypeError: Expected "van" to cast to a
>> >     Friendly::UUID (invalid bytecount)
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:32:in
>> >     `initialize'
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>> >     `new'
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>> >     `convert_ids_to_uuids'
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
>> >     `initialize'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>> >     `new'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>> >     `query'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
>> >     `first'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
>> >     `find'
>> >
>> >     /I tried another query:
>> >
>> >     |||BlogPost.find(||:author=>"james")
>> >
>> >     |I got error:
>> >     /Friendly::UUID::TypeError: Expected {:author=>"van"} to cast to a
>> >     Friendly::UUID (unknown source class)
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:58:in
>> >     `initialize'
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>> >     `new'
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in
>> >     `convert_ids_to_uuids'
>> >         from
>> >
>> /home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in
>> >     `initialize'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>> >     `new'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in
>> >     `query'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in
>> >     `first'
>> >         from
>> >
>> 
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in
>> >     `find'
>> >     /
>> >     Could you explain me these error message?
>> >
>> >     Thanks,
>> >     Van
>> >
>> >
>> >
>> >
>> > --
>> > It's better to be a pirate than join the Navy - Steve Jobs
>> > http://mclov.in
>>
>>
>>
>
>
> --
> It's better to be a pirate than join the Navy - Steve Jobs
> http://mclov.in
>

Re: [friendly] [Fwd: Friendly query error]

From:
Le Van
Date:
2010-02-26 @ 03:24
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi James,<br>
I'm using irb by run "ruby script/console". Here the stack trace.<br>
<br>
<i><b>Loading development environment (Rails 2.3.5)</b><br>

/home/pilgrim/Documents/working/RoR/study/learn-from-plugins/ar-context/vendor/rails/railties/lib/commands/console.rb:45:
warning: Insecure world writable dir
/home/pilgrim/opt/java/apache-maven-2.2.1/bin in PATH, mode 040777<br>
/home/pilgrim/.gem/ruby/1.8/gems/json_pure-1.2.0/lib/json/common.rb:61:
warning: already initialized constant State<br>
/home/pilgrim/.gem/ruby/1.8/gems/json_pure-1.2.0/lib/json/pure.rb:76:
warning: already initialized constant JSON_LOADED<br>
<b>>> BlogPost.create_tables!</b><br>
=> [#<Friendly::DocumentTable:0xb6deef84
@datastore=#<Friendly::DataStore:0xb6d9810c
@database=#<Sequel::MySQL::Database:
"mysql://root:root@localhost/friendly_development">>,
@translator=#<Friendly::Translator:0xb6deef5c @serializer=JSON,
@time=Time>, @klass=BlogPost>, #<Friendly::Index:0xb6deef20
@datastore=#<Friendly::DataStore:0xb6d9810c
@database=#<Sequel::MySQL::Database:
"mysql://root:root@localhost/friendly_development">>,
@fields=[:author], @klass=BlogPost>, #<Friendly::Index:0xb6deeebc
@datastore=#<Friendly::DataStore:0xb6d9810c
@database=#<Sequel::MySQL::Database:
"mysql://root:root@localhost/friendly_development">>,
@fields=[:created_at], @klass=BlogPost>]<br>
<b>>> BlogPost.create :author=>"james", :title=>"friendly",
:body=>"nosql"</b><br>
=> #<BlogPost:0xb6de4b4c @new_record=false, @changed=#<Set:
{}>, @title_was=nil, @body="nosql", @author_was=nil,
@updated_at_was=nil, @body_was=nil, @title="friendly",
@created_at_was=nil, @author="james", @id_was=nil, @updated_at=Fri Feb
26 10:17:05 +0700 2010, @id=<Friendly::UUID#-613473028 time: Fri Feb
26 10:17:05 +0700 2010, usecs: 39727 jitter: 14267794520260744579>,
@created_at=Fri Feb 26 10:17:05 +0700 2010><br>
<b>>> BlogPost.all(:author=>"james")</b><br>
Sequel::Error: Invalid operator =<br>
    from
/home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/sql.rb:140:in
`initialize'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:26:in
`new'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:26:in
`from_value_pairs'<br>
    from (irb):3:in `collect'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:11:in
`each'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:11:in
`collect'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:11:in
`from_value_pairs'<br>
    from
/home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/dataset/query.rb:383:in
`filter_expr'<br>
    from
/home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/dataset/query.rb:362:in
`_filter'<br>
    from
/home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/dataset/sql.rb:543:in
`where'<br>
    from
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/data_store.rb:16:in
`all'<br>
    from
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/index.rb:27:in
`all'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/storage_proxy.rb:107:in
`perform_all'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/storage_proxy.rb:25:in
`all'<br>
    from

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:33:in
`all'<br>
    from (irb):3<br>
<br>
Regards,<br>
Van<br>
</i>   <br>
James Golick wrote:
<blockquote
 cite="mid:1ab2da821002251026p5a42ebffy3899b7b07ac71187@mail.gmail.com"
 type="cite">Can you repeat these bugs in an irb session and gist *all*
of the output from that session please?
  <div><br>
  </div>
  <div>- James<br>
  <br>
  <div class="gmail_quote">On Thu, Feb 25, 2010 at 3:28 AM, Arun Thampi
  <span dir="ltr"><<a moz-do-not-send="true"
 href="mailto:arun.thampi@gmail.com">arun.thampi@gmail.com</a>></span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 
0.8ex; padding-left: 1ex;"><br>
    <br>
    <div class="gmail_quote">
    <div class="im">On Thu, Feb 25, 2010 at 7:18 PM, Le Van <span
 dir="ltr"><<a moz-do-not-send="true"
 href="mailto:van.le@vn.pyramid-consulting.com" 
target="_blank">van.le@vn.pyramid-consulting.com</a>></span>
wrote:<br>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 
0.8ex; padding-left: 1ex;">
Hi Arun,<br>
Thank for your quick reply.<br>
I'm using Mysql 5.1, Karmic. As you can see the error log, I'm using<br>
friendly-0.5.1.<br>
The database and tables also created.<br>
The first error is weird.<br>
The second error is my fault. I should try to use "first" instead. But<br>
calling first got the same error as calling 'all'.<br>
    </blockquote>
    <div><br>
    </div>
    </div>
    <div>Hmm strange, have not seen anything like that error before. I
also use 5.1 with my charset set as UTF-8. Is that the entire error
stacktrace? Can you paste the full error (including where in Friendly
the error is being caused)?</div>
    <div class="im">
    <div> </div>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 
0.8ex; padding-left: 1ex;">One
question: In my db, the uuid is in the form of "Ìå ,!T ß”†Y T áÚ"<br>
Is it wrong compare to "3c546520-042a-012d-1d9d-001b63387ea5" ?<br>
    </blockquote>
    <div><br>
    </div>
    </div>
    <div>No, Friendly stores UUID's in 16-byte binary form and not
string form, so it is normal to see that output. For more, you can look
at ./lib/friendly/uuid.rb (Friendly::UUID class) under the friendly
repo.</div>
    <div>
    <div class="h5">
    <div> </div>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 
0.8ex; padding-left: 1ex;">My
db charset is UTF-8 also.<br>
Thanks again,<br>
Van<br>
      <div>Arun Thampi wrote:<br>
> Hi Van - I don't see the first error that you describe (I ran the
same<br>
> steps as the instructions on the <a moz-do-not-send="true"
 href="http://friendlyorm.com" target="_blank">friendlyorm.com</a><br>
      </div>
> <<a moz-do-not-send="true" href="http://friendlyorm.com"
 target="_blank">http://friendlyorm.com</a>> site) but the #find
method for Friendly<br>
      <div>> documents is only used to find by ID (which is a UUID,
something which<br>
> looks like this: "3c546520-042a-012d-1d9d-001b63387ea5", so<br>
> BlogPost.find("3c546520-042a-012d-1d9d-001b63387ea5") is a valid<br>
> statement). After you save a document to the database and retrieve
it,<br>
> when you call the #id.to_guid method on the document, it will give
you<br>
> a string representation of the ID of your document.<br>
><br>
>   Not sure of the first error though, any other details - are you<br>
> using MySQL or Postgres? You've confirmed that the tables exist<br>
> (although the absence of tables should throw another error)?<br>
><br>
> HTH.<br>
><br>
> Cheers,<br>
> Arun<br>
><br>
> On Thu, Feb 25, 2010 at 6:50 PM, Le Van<br>
> <<a moz-do-not-send="true"
 href="mailto:van.le@vn.pyramid-consulting.com" 
target="_blank">van.le@vn.pyramid-consulting.com</a><br>
      </div>
      <div>> <mailto:<a moz-do-not-send="true"
 href="mailto:van.le@vn.pyramid-consulting.com" 
target="_blank">van.le@vn.pyramid-consulting.com</a>>>
wrote:<br>
><br>
><br>
><br>
><br>
>     ---------- Forwarded message ----------<br>
>     From: Le Van <<a moz-do-not-send="true"
 href="mailto:van.le@vn.pyramid-consulting.com" 
target="_blank">van.le@vn.pyramid-consulting.com</a><br>
      </div>
      <div>
      <div>>     <mailto:<a moz-do-not-send="true"
 href="mailto:van.le@vn.pyramid-consulting.com" 
target="_blank">van.le@vn.pyramid-consulting.com</a>>><br>
>     To: <a moz-do-not-send="true"
 href="mailto:friendly@librelist.com" target="_blank">friendly@librelist.com</a>
<mailto:<a moz-do-not-send="true"
 href="mailto:friendly@librelist.com" 
target="_blank">friendly@librelist.com</a>><br>
>     Date: Thu, 25 Feb 2010 17:33:07 +0700<br>
>     Subject: Friendly query error<br>
>     Hi,<br>
>     I am trying to use friendly by following the guidance from<br>
>     <a moz-do-not-send="true" href="http://friendlyorm.com/"
 target="_blank">http://friendlyorm.com/</a>.<br>
><br>
>     At step Query,<br>
>     |||BlogPost.all(||:author| |=> ||"James Golick"||)|<br>
><br>
>     I got error:<br>
>     /Sequel::Error: Invalid operator =<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/sequel-3.8.0/lib/sequel/sql.rb:140:in<br>
>     `initialize'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/sequel_monkey_patches.rb:26:in<br>
>     `new'<br>
>     /<br>
>     I tried another query:<br>
><br>
>     |||BlogPost.find(||"james")<br>
><br>
>     |I got error:<br>
>     /Friendly::UUID::TypeError: Expected "van" to cast to a<br>
>     Friendly::UUID (invalid bytecount)<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:32:in<br>
>     `initialize'<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in<br>
>     `new'<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in<br>
>     `convert_ids_to_uuids'<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in<br>
>     `initialize'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in<br>
>     `new'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in<br>
>     `query'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in<br>
>     `first'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in<br>
>     `find'<br>
><br>
>     /I tried another query:<br>
><br>
>     |||BlogPost.find(||:author=>"james")<br>
><br>
>     |I got error:<br>
>     /Friendly::UUID::TypeError: Expected {:author=>"van"} to
cast to a<br>
>     Friendly::UUID (unknown source class)<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/uuid.rb:58:in<br>
>     `initialize'<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in<br>
>     `new'<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:33:in<br>
>     `convert_ids_to_uuids'<br>
>         from<br>
>    
/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/query.rb:17:in<br>
>     `initialize'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in<br>
>     `new'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:46:in<br>
>     `query'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/storage.rb:29:in<br>
>     `first'<br>
>         from<br>
>    

/home/pilgrim/.gem/ruby/1.8/gems/friendly-0.5.1/lib/friendly/document/convenience.rb:16:in<br>
>     `find'<br>
>     /<br>
>     Could you explain me these error message?<br>
><br>
>     Thanks,<br>
>     Van<br>
><br>
><br>
><br>
><br>
> --<br>
> It's better to be a pirate than join the Navy - Steve Jobs<br>
> <a moz-do-not-send="true" href="http://mclov.in" 
target="_blank">http://mclov.in</a><br>
      <br>
      <br>
      </div>
      </div>
    </blockquote>
    </div>
    </div>
    </div>
    <div>
    <div class="h5"><br>
    <br clear="all">
    <br>
-- <br>
It's better to be a pirate than join the Navy - Steve Jobs<br>
    <a moz-do-not-send="true" href="http://mclov.in" 
target="_blank">http://mclov.in</a><br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
  </div>
</blockquote>
<br>
</body>
</html>