Re: [Catalyst] ActiveRecord for Perl

2007-05-23 Thread John Siracusa
On 5/22/07 8:07 PM, Matt S Trout wrote:
 I discussed merging the projects with jcs a while back but he didn't see the
 point of the ResultSet chaining system, which I consider DBIC's key killer
 feature

I just didn't think a merge made sense since the two projects have different
philosophies and very different APIs.  It's not that I don't understand
result sets (RDBO will likely get them some day, in fact), they just weren't
as important to me.  I had a few specific things I wanted to do with RDBO
and I did them first.  It was a pragmatic approach.

 In the meantime, RDBO is a brilliantly well-written system and if you're with
 jcs in not seeing the point of the (functional-ish/set-arithmetic-ish
 resultset concept) and not wanting to be able to subclass to override at any
 level of the process, it's a very useful option.

IME, it's not a matter of not seeing the point of a resultset approach,
but rather a preference for a particular API type.  That is, it's a matter
of taste rather than one of ignorance.

 I usually tell people to examine both and choose whichever best suits their
 project - the experienced developers seem -usually- to end up going for
 DBIx::Class by default, Rose::DB::Object when they need speed over features
 but that's my personal experience from discussion with a few hundred perl
 developers, not a statement of intent/recommendation.
 Rose::DB::Object

Although performance may attract people to RDBO initially, I think the
people who decide to stick with it do so for other reasons: they like the
API, it has some particular feature they want, etc.  I've never taken a
survey, but that's my impression based on RDBO mailing list traffic and so
on.  I can tell you that I'd personally keep using RDBO even if it was the
slowest ORM, but perhaps that's not too surprising ;)

-John



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-23 Thread Matt S Trout
On Wed, May 23, 2007 at 11:05:44AM -0400, John Siracusa wrote:
  In the meantime, RDBO is a brilliantly well-written system and if you're 
  with
  jcs in not seeing the point of the (functional-ish/set-arithmetic-ish
  resultset concept) and not wanting to be able to subclass to override at any
  level of the process, it's a very useful option.
 
 IME, it's not a matter of not seeing the point of a resultset approach,
 but rather a preference for a particular API type.  That is, it's a matter
 of taste rather than one of ignorance.

Hmm. I think that's a semantic mismatch, that's basically what I meant. That
you don't see the point for your purposes doesn't mean that you don't
understand why others do for theirs.

I still personally believe resultset chaining to be a lisp-vs-blub-ism, and
find that the majority of people who try it find it addictive, but that could
purely be a matter of my sample self-selecting.

  I usually tell people to examine both and choose whichever best suits their
  project - the experienced developers seem -usually- to end up going for
  DBIx::Class by default, Rose::DB::Object when they need speed over 
  features
  but that's my personal experience from discussion with a few hundred perl
  developers, not a statement of intent/recommendation.
  Rose::DB::Object
 
 Although performance may attract people to RDBO initially, I think the
 people who decide to stick with it do so for other reasons: they like the
 API, it has some particular feature they want, etc.  I've never taken a
 survey, but that's my impression based on RDBO mailing list traffic and so
 on.  I can tell you that I'd personally keep using RDBO even if it was the
 slowest ORM, but perhaps that's not too surprising ;)

I tend to think in terms of conceptual mapping rather than in terms of
API details, and I think I could fairly easily implement the DBIC API atop
RDBO and vice versa (modulo the odd missing feature on either side), so I
beg to disagree with your they're too different assertion.

At the point at which I originally discussed it with you I'd have been happy
to write a DBIC layer over RDBO if I'd been permitted to patch a resultset
concept into the latter, but I got the impression you didn't want it at
all; I'm glad to hear that you're planning to eventually add it to RDBO
but at this stage we're a little late in the game for a merge to be viable.

Never mind, maybe we can collaborate on a perl6 ORM when there's a production
implementation of the language for us to code to :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-23 Thread John Siracusa
On 5/23/07 12:47 PM, Matt S Trout wrote:
 I tend to think in terms of conceptual mapping rather than in terms of
 API details, and I think I could fairly easily implement the DBIC API atop
 RDBO and vice versa (modulo the odd missing feature on either side)

Sure, but what would the result look like?  I think it's wise to concentrate
on a single API.  Just look at CDBICompat for an example of how hard it is
to maintain two APIs, even when one is preexisting.  It's also a headache
for users: which is the real or native API?

 Never mind, maybe we can collaborate on a perl6 ORM when there's a production
 implementation of the language for us to code to :)

Yes, I've always considered this all prototype work for Perl 6...although
then we have to allow for the first two throw-away ORMs for Perl 6 as we all
learn how the heck to use the language in the best way.  It never ends... ;)

-John



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-23 Thread Wade . Stuart





Christopher H. Laco [EMAIL PROTECTED] wrote on 05/23/2007 12:49:20
PM:

 John Siracusa wrote:
 [snip]
  Yes, I've always considered this all prototype work for Perl
6...although
  then we have to allow for the first two throw-away ORMs for Perl 6as we
all

 Let the CDBI port take care of that. :-P


Funny,  I consider it two throw away ORMs too.

=)


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Adam Bartosik

I'm considering trying to port Ruby's ActiveRecord to Perl
as a lightweight ORM option (with some small changes
maybe, like composite PKs). If anyone's interested, toss
me a message privately and we'll coordinate.


What I found missing in DBIx::Class is AR method find_by_sql(sql).
We use catalystdbix for months (kind of data-warehouse project), but 
rewriting complex, read-only SQL statements to dbix/perl notation is for 
me a waste of time (when editing  updating tables with ORM is so fast 
to code and intuitive).


However is it worth to build just-another-orm for perl when DBIx::Class 
is not so far to be really good one?



--
[EMAIL PROTECTED]  http://www.hurra-communications.com/
$ o m et e a m  .  d e v e l o p e r
Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread mla

Adam Bartosik wrote:

I'm considering trying to port Ruby's ActiveRecord to Perl
as a lightweight ORM option (with some small changes
maybe, like composite PKs). If anyone's interested, toss
me a message privately and we'll coordinate.


What I found missing in DBIx::Class is AR method find_by_sql(sql).
We use catalystdbix for months (kind of data-warehouse project), but 
rewriting complex, read-only SQL statements to dbix/perl notation is for 
me a waste of time (when editing  updating tables with ORM is so fast 
to code and intuitive).


However is it worth to build just-another-orm for perl when DBIx::Class 
is not so far to be really good one?


Maybe not. Or maybe we could write a wrapper to give more of an AR
interface.

I'm currently trying to decide on Catalyst or Rails for a new project.
I like the flexibility of Catalyst (and love Perl), but I'm attracted to
a lot of the design decisions in Rails (I like the fact, for example,
that ActiveRecord::Validations supports data validation in the model,
just like we were discussing in a previous thread).

So part of me would like to see a more Rails-like layer on top of
Catalyst.

Maurice

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Eduard Giménez
 I'm considering trying to port Ruby's ActiveRecord to Perl as 
 a lightweight ORM option (with some small changes maybe, like 
 composite PKs). If anyone's interested, toss me a message 
 privately and we'll coordinate.

Why not simply colaborate to extend DBIx?

-- 

Eduard Giménez
CAPSiDE Systems Engineer
[EMAIL PROTECTED]


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Adam Bartosik

I'm currently trying to decide on Catalyst or Rails for a new project.
I like the flexibility of Catalyst (and love Perl), but I'm attracted to
a lot of the design decisions in Rails (I like the fact, for example,
that ActiveRecord::Validations supports data validation in the model,
just like we were discussing in a previous thread).


Months ago I gave a try for ROR. What is good compared to Catalyst?

- documentation. It is easy to start, good doc, there are many books, 
tutos about it. Catalyst doc is... nothing interesting, sometimes 
inconsistent, sometimes broken links. Even less popular frameworks in 
Python like Pylons have better doc, are easier to start with. Because of 
flexibility, Catalyst could be very difficult at start (many chooses)


- various web-related libs are better, up to date in Ror, eg. prototype

My problems with ROR:
- composite keys not out of the box
- quoting names (I didn't find any workaround, maybe 2h of googling and 
trying to fix it is too less?)

- much fighting to use for existing DB

Sometimes you need to use something from CPAN and gems are not so 
solution-full.


I think when you start a new agile project, ROR can be very helpful - 
especially when you need some rules (for project team), some design 
constraints, it is simple - do it our way. There is no such religious 
approach with Catalyst, you can do what you want typically the way you want.



--
[EMAIL PROTECTED]  http://www.hurra-communications.com/
$ o m et e a m  .  d e v e l o p e r
Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 09:33:37AM +0200, Adam Bartosik wrote:
 I'm considering trying to port Ruby's ActiveRecord to Perl
 as a lightweight ORM option (with some small changes
 maybe, like composite PKs). If anyone's interested, toss
 me a message privately and we'll coordinate.
 
 What I found missing in DBIx::Class is AR method find_by_sql(sql).
 We use catalystdbix for months (kind of data-warehouse project), but 
 rewriting complex, read-only SQL statements to dbix/perl notation is for 
 me a waste of time (when editing  updating tables with ORM is so fast 
 to code and intuitive).

What would that achieve that passing literal SQL chunks for SELECT, FROM,
WHERE etc. wouldn't?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Eden Cardim

On 5/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

one thing i really like about AR is the association proxies, where
relationships themselves are objects you can call methods (ie, find) on

  class User  ActiveRecord::Base
has_many :items
  end
  class Item  ActiveRecord::Base
belongs_to :user
  end

  items = user.items
  item = user.items.find(params[:id])
  new_item = user.items.create!(params[:item])

you can get close to that with RDBO's $user-find_items() (and maybe DBIC
has something similarish) but the ruby way here feels so much better!


ruby way? That's exactly how DBIC works.

--
Eden Cardim
Instituto Baiano de Biotecnologia
Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas
Laboratório de Bioinformática

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread mreece
 On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote:

 I doubt there's anything worth porting in ActiveRecord that one of the
 many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram,
 Alzabo) doesn't provide.

 - Perrin

one thing i really like about AR is the association proxies, where
relationships themselves are objects you can call methods (ie, find) on

  class User  ActiveRecord::Base
has_many :items
  end
  class Item  ActiveRecord::Base
belongs_to :user
  end

  items = user.items
  item = user.items.find(params[:id])
  new_item = user.items.create!(params[:item])

you can get close to that with RDBO's $user-find_items() (and maybe DBIC
has something similarish) but the ruby way here feels so much better!



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Lampert, Hugh



-Original Message-
From: mla [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 22, 2007 4:25 AM
To: The elegant MVC web framework

So part of me would like to see a more Rails-like layer on top of
Catalyst.

Sounds like you really want to write a Rails-like layer for Catalyst!

Disclaimer:
This message is for the named person's use only. It may contain confidential, 
proprietary or legally privileged 
information. The above information has been prepared for information purposes 
only. The above does not constitute
an offer, recommendation or solicitation to buy or sell, nor is it an official 
confirmation of terms. While the 
information herein has been obtained from sources believed to be reliable, 
Landesbank Baden-Württemberg makes 
no representation that it is accurate or complete and it should not be relied 
upon as such. Neither Landesbank
Baden-Württemberg nor any employee herein guarantees the information contained 
in this message. No confidentiality 
or privilege is waived or lost by any mistransmission. If you receive this 
message in error, please immediately 
delete it and all copies of it from your system, destroy any hard copies of it 
and notify the sender. You are 
not entitled to, directly or indirectly, use, disclose, distribute,print, or 
copy any part of this message if 
you are not the intended recipient.Any views expressed in this message are 
those of the individual sender, except
where the sender specifies and with authority, states them to be the views of 
Landesbank Baden-Wurttemberg.


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 06:53:00AM -0700, [EMAIL PROTECTED] wrote:
  On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote:
 
  I doubt there's anything worth porting in ActiveRecord that one of the
  many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram,
  Alzabo) doesn't provide.
 
  - Perrin
 
 one thing i really like about AR is the association proxies, where
 relationships themselves are objects you can call methods (ie, find) on

DBIC relationships return resultset objects in scalar context:

   class User  ActiveRecord::Base
 has_many :items

__PACKAGE__-has_many('items', 'MyApp::DB::Item');

   end
   class Item  ActiveRecord::Base
 belongs_to :user

__PACKAGE__-belongs_to('user', 'MyApp::DB::User');

   end
 
   items = user.items

my @items = $user-items;

or

my $items_rs = $user-items;

   item = user.items.find(params[:id])

my $item = $user-items-find($item_id);

   new_item = user.items.create!(params[:item])

my $new_item = $user-items-create(\%item_info);
 
 you can get close to that with RDBO's $user-find_items() (and maybe DBIC
 has something similarish) but the ruby way here feels so much better!

How?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Adam Bartosik

What would that achieve that passing literal SQL chunks for SELECT, FROM,
WHERE etc. wouldn't?


Readability. Complex SQL statements are more clear to understand than 
complex dbix statements when you are not an author of DBIX ;)
I can also test it with simple copypaste to sql console to see how it 
works, how it is planned / optimized.


I know it is ORM and database abstraction, I'm theoretically independent 
from my DB vendor and so on, but it doesn't change the fact it is more 
complicated, more noise, more strange -opt { qw[col1 col2] } than 
pure SQL statement.


And when all this Catalyst/Dbix stuff is so flexible - why I should 
fight with such approach?


--
[EMAIL PROTECTED]  http://www.hurra-communications.com/
$ o m et e a m  .  d e v e l o p e r
Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 05:36:18PM +0200, Adam Bartosik wrote:
 What would that achieve that passing literal SQL chunks for SELECT, FROM,
 WHERE etc. wouldn't?
 
 Readability. Complex SQL statements are more clear to understand than 
 complex dbix statements when you are not an author of DBIX ;)
 I can also test it with simple copypaste to sql console to see how it 
 works, how it is planned / optimized.
 
 I know it is ORM and database abstraction, I'm theoretically independent 
 from my DB vendor and so on, but it doesn't change the fact it is more 
 complicated, more noise, more strange -opt { qw[col1 col2] } than 
 pure SQL statement.
 
 And when all this Catalyst/Dbix stuff is so flexible - why I should 
 fight with such approach?

Ok, I can see all of those arguments.

So here's the one big remaining question - why haven't you worked out what
syntax you'd like to see for this feature and started a thread on the
dbix-class list to discuss it? :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread John Goulah

I agree with you, using DBIx for simple stuff is fine, but after a while raw
SQL is sometimes nice to have.

I cant figure out how to return the data in object form, but this will at
least give you some data:

__PACKAGE__-load_components(qw/
   ResultSetManager
   PK::Auto
   Core
   /);

sub get_data : ResultSet {
   my ($self) = @_;
   my $dbh = $self-result_source-schema-storage-dbh;

   ## use the handle, return data
}

http://search.cpan.org/~JROBINSON/DBIx-Class-0.07005/lib/DBIx/Class/Manual/Cookbook.pod#Predefined_searches_without_writing_a_ResultSet_class

But this is not so useful if you cant return it in object form.  (Want to be
able to call functions/associations on that object).  CDBI does it with
sth_to_objects, and there is a CDBI compatibility layer, but I cant seem to
get it working correctly.


John




On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote:


 What would that achieve that passing literal SQL chunks for SELECT,
FROM,
 WHERE etc. wouldn't?

Readability. Complex SQL statements are more clear to understand than
complex dbix statements when you are not an author of DBIX ;)
I can also test it with simple copypaste to sql console to see how it
works, how it is planned / optimized.

I know it is ORM and database abstraction, I'm theoretically independent
from my DB vendor and so on, but it doesn't change the fact it is more
complicated, more noise, more strange -opt { qw[col1 col2] } than
pure SQL statement.

And when all this Catalyst/Dbix stuff is so flexible - why I should
fight with such approach?

--
[EMAIL PROTECTED]  http://www.hurra-communications.com/
$ o m et e a m  .  d e v e l o p e r
Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Adam Bartosik

So here's the one big remaining question - why haven't you worked out what
syntax you'd like to see for this feature and started a thread on the
dbix-class list to discuss it? :)


Good point. To be honest - I need to dig deeply into dbix structure to 
propose something in the dbix way.
The main feature I would like to get from dbix as a wrapper for SQL 
statement is pagination.

Ok, see you on dbix list ;)

--
[EMAIL PROTECTED]  http://www.hurra-communications.com/
$ o m et e a m  .  d e v e l o p e r
Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 11:52:22AM -0400, John Goulah wrote:
 I agree with you, using DBIx for simple stuff is fine, but after a while raw
 SQL is sometimes nice to have.

Personally I find it worthwhile to reformulate queries in DBIC form - I find
complex queries are usually there for reporting purposes and being able to
filter, page etc. reports using the usual DBIC syntax is worth the effort of
doing the conversion.

But that may just be me :) - and what I'd really love to see is somebody
use one of the SQL parser modules on CPAN to allow a standalone query to
be backtracked into a resultset so you can get the best of both these
approaches; however nobody's stepped up to do it and there are things I
consider more of a priority for my own development time.

 But this is not so useful if you cant return it in object form.  (Want to be
 able to call functions/associations on that object).  CDBI does it with
 sth_to_objects, and there is a CDBI compatibility layer, but I cant seem to
 get it working correctly.

I've actually replied on the dbix-class list showing you how to do this in
pure DBIC - the CDBICompat layer should only ever be used for its intended
purpose, there are too many hacks in it to make the 'compatibility' part work.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 01:14:31PM -0300, Eden Cardim wrote:
 On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote:
 Good point. To be honest - I need to dig deeply into dbix structure to
 propose something in the dbix way.
 The main feature I would like to get from dbix as a wrapper for SQL
 statement is pagination.
 
 DBIC::RS has paging, just use the 'rows' and 'page' attrs.

That's where we start to run into trouble - DBIC can provide all this stuff
but it needs the metadata, which means it needs the query in DBIC form.

Anyway, we'll discuss on't appropriate list :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Michael Reece


On May 22, 2007, at 7:58 AM, Matt S Trout wrote:


  item = user.items.find(params[:id])


my $item = $user-items-find($item_id);


  new_item = user.items.create!(params[:item])


my $new_item = $user-items-create(\%item_info);


that's great; i thought i had recalled something similar, but  
couldn't find it again in my quick skim of DBIx::Class::Manual::*


you can get close to that with RDBO's $user-find_items() (and  
maybe DBIC

has something similarish) but the ruby way here feels so much better!


How?


personal satisfaction.




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 09:29:25AM -0700, Michael Reece wrote:
 
 On May 22, 2007, at 7:58 AM, Matt S Trout wrote:
 
   item = user.items.find(params[:id])
 
 my $item = $user-items-find($item_id);
 
   new_item = user.items.create!(params[:item])
 
 my $new_item = $user-items-create(\%item_info);
 
 that's great; i thought i had recalled something similar, but  
 couldn't find it again in my quick skim of DBIx::Class::Manual::*
 
 you can get close to that with RDBO's $user-find_items() (and  
 maybe DBIC
 has something similarish) but the ruby way here feels so much better!
 
 How?
 
 personal satisfaction.

Right, but the DBIC code involved is almost identical.

Given that you now know that, would you be willing to consider contributing
any features you consider missing in DBIx::Class rather than writing another
implementation of essentially the same API? (DBIC is intentionally not
opinionated to let people do things their way with it - there are more than
enough perl ORM projects already and I wanted to provide something people could
subclass/extend rather than have to re-invent again :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread mla

John Napiorkowski wrote:

--- Eduard Giménez [EMAIL PROTECTED] wrote:


I'm considering trying to port Ruby's ActiveRecord
to Perl as 

a lightweight ORM option (with some small changes
maybe, like 

composite PKs). If anyone's interested, toss me a
message 

privately and we'll coordinate.

Why not simply colaborate to extend DBIx?


Just as a followup to that, you should really try to
write a list of everything you think is missing from
DBIx and discuss it over on the project mailing list. 
The framework is designed around a component

architecture so it's straightforward to add or alter
features.  I find it unlikely you will be able to
match it's features without more than a year of
consistent effort.


Okay, thanks. I will do that. I'm mainly looking to
strip features, not match them.


Some of the validation stuff that AR does for you
could be handled by some hacking on DBIC::Validation
although to be honest good design would preclude
wanted to put all your validation in the physical
model class.


Agreed.

Maurice

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread mla

Perrin Harkins wrote:

On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote:

What I found missing in DBIx::Class is AR method find_by_sql(sql).


Did you ask about it on the mailing list?  Nearly all of the Perl ORMs
have support for direct SQL.  I don't know DBIx::Class, but
search_literal sounds like what you want.

I doubt there's anything worth porting in ActiveRecord that one of the
many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram,
Alzabo) doesn't provide.


If I may ask, Perrin, what do you use?

Maurice

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Christopher H. Laco
mla wrote:
 Christopher H. Laco wrote:
 mla wrote:
 Perrin Harkins wrote:
 On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote:
 What I found missing in DBIx::Class is AR method find_by_sql(sql).
 Did you ask about it on the mailing list?  Nearly all of the Perl ORMs
 have support for direct SQL.  I don't know DBIx::Class, but
 search_literal sounds like what you want.

 I doubt there's anything worth porting in ActiveRecord that one of the
 many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram,
 Alzabo) doesn't provide.
 If I may ask, Perrin, what do you use?

 Maurice

 I'm one of those odd birds that's used CDBI, DBIC and RDBO.
 I've converted from CDBI to DBIC and also written an RDBO layer for a
 project.

 /CDBI smart ass comments deleted/ :-)

 They all have their quirks. DBIC does a great job of getting out of your
 way. If there's an option, chances are you can set it at the class
 and/or object instance level, allowing fair amounts of evil to be
 accomplished. :-)

 RDBO tickles my fancy if I'm really into triggers at the various stages
 of data usage. What I really really missed from DBIC when writing RDBO
 was deploy(). The ability to just kick out a db schema into a DB from a
 DBIC schema totally rocks.
 
 Thanks for sharing your experiences. Other than the the deploy() stuff,
 any other criticisms of RDBO? Now that I'm looking at it again, I'm
 liking the design very much.
 
 I found this thread that compared some of the differences (might be
 outdated now):
 
   http://www.gossamer-threads.com/lists/catalyst/users/3095
 
 What would cause you to *not* use RDBO on a new project?
 
 Maurice

Just for giggles, you can compare the two sets of glue:

http://search.cpan.org/src/CLACO/Handel-Storage-RDBO-0.01_02/lib/Handel/Storage/RDBO.pm
http://search.cpan.org/src/CLACO/Handel-0.99_18/lib/Handel/Storage/DBIC.pm

Same API...different ORMS.




signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Christopher H. Laco
mla wrote:
 Christopher H. Laco wrote:
 mla wrote:
 Perrin Harkins wrote:
 On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote:
 What I found missing in DBIx::Class is AR method find_by_sql(sql).
 Did you ask about it on the mailing list?  Nearly all of the Perl ORMs
 have support for direct SQL.  I don't know DBIx::Class, but
 search_literal sounds like what you want.

 I doubt there's anything worth porting in ActiveRecord that one of the
 many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram,
 Alzabo) doesn't provide.
 If I may ask, Perrin, what do you use?

 Maurice

 I'm one of those odd birds that's used CDBI, DBIC and RDBO.
 I've converted from CDBI to DBIC and also written an RDBO layer for a
 project.

 /CDBI smart ass comments deleted/ :-)

 They all have their quirks. DBIC does a great job of getting out of your
 way. If there's an option, chances are you can set it at the class
 and/or object instance level, allowing fair amounts of evil to be
 accomplished. :-)

 RDBO tickles my fancy if I'm really into triggers at the various stages
 of data usage. What I really really missed from DBIC when writing RDBO
 was deploy(). The ability to just kick out a db schema into a DB from a
 DBIC schema totally rocks.
 
 Thanks for sharing your experiences. Other than the the deploy() stuff,
 any other criticisms of RDBO? Now that I'm looking at it again, I'm
 liking the design very much.
 
 I found this thread that compared some of the differences (might be
 outdated now):
 
   http://www.gossamer-threads.com/lists/catalyst/users/3095
 
 What would cause you to *not* use RDBO on a new project?
 
 Maurice

Well, to be fair to RDBO, I'm just not as familiar with it as I am with
DBIC. When I was doing the storage layer for RDBO, what I missed (aside
from deploy) was the *_related methods and the fact that resultsets are
chainable. DBIC appears to take the approach that given object A, I can
always get to related object B through object A accessors, helpers,
*_related etc.

RDBO seemed to tale take the opposite approach. Instead of working from
one object to another, you went through *Manager classes when odd things
are called for.

Managers...ResultSets

There's been a lot of traffic on RDBO lately polishing helper methods
for relations and other such stuff

Really, they're both great ORMS. I just prefer DBIC. Some prefer RDBO.
Both are powerful. Just don't use CDBI. :-P

(Sorry, couldn't resist).

Repeat after me: Thou Shalt Never Create A CDBI Storage Layer For
Handel. :-)

-=Chris



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Perrin Harkins

On 5/22/07, mla [EMAIL PROTECTED] wrote:

If I may ask, Perrin, what do you use?


I have a large system that was started back when Class::DBI was a hot
new thing.  It still uses CDBI and hasn't really had a good reason to
change, since we use a lot of custom SQL and that's pretty easy to do
with CDBI (and performs well).  For new projects, I'm trying
Rose::DB::Object.  I had good success using the query builder from
RDBO on its own for one project.  A lot of the database work I do
doesn't go through any ORM because it involves complex reporting.

There are some good features in the other ones too.  Tangram is a
pretty amazing accomplishment.  DBIx::Class abstracts some things that
the others don't, making it more flexible.  RDBO seems to suit me best
at the moment though.

- Perrin

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 12:03:43PM -0700, mla wrote:
 Okay, thanks. I will do that. I'm mainly looking to
 strip features, not match them.

DBIx::Class' component architecture makes it easy to do that too.

It's pretty much an ORM construction kit that just happens to provide
a default recipe :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Peter Karman



Christopher H. Laco wrote on 5/22/07 2:47 PM:


Well, to be fair to RDBO, I'm just not as familiar with it as I am with
DBIC. When I was doing the storage layer for RDBO, what I missed (aside
from deploy) was the *_related methods and the fact that resultsets are
chainable. DBIC appears to take the approach that given object A, I can
always get to related object B through object A accessors, helpers,
*_related etc.

RDBO seemed to tale take the opposite approach. Instead of working from
one object to another, you went through *Manager classes when odd things
are called for.



Actually, RDBO works like you describe DBIC. The *Manager classes are for groups 
of objects. For one object to another, you use the fk and relationship Metadata 
definitions (1-1, 1-m, m-m, etc).


 $objectB = $objectA-objectB;

--
Peter Karman  .  http://peknet.com/  .  [EMAIL PROTECTED]

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Matt S Trout
On Tue, May 22, 2007 at 03:46:16PM -0500, Peter Karman wrote:
 
 
 Christopher H. Laco wrote on 5/22/07 2:47 PM:
 
 Well, to be fair to RDBO, I'm just not as familiar with it as I am with
 DBIC. When I was doing the storage layer for RDBO, what I missed (aside
 from deploy) was the *_related methods and the fact that resultsets are
 chainable. DBIC appears to take the approach that given object A, I can
 always get to related object B through object A accessors, helpers,
 *_related etc.
 
 RDBO seemed to tale take the opposite approach. Instead of working from
 one object to another, you went through *Manager classes when odd things
 are called for.
 
 
 Actually, RDBO works like you describe DBIC. The *Manager classes are for 
 groups of objects. For one object to another, you use the fk and 
 relationship Metadata definitions (1-1, 1-m, m-m, etc).
 
  $objectB = $objectA-objectB;

So far as I can see, the basic difference is -

DBIx::Class aims for fast enough and extremely extensible/flexible

Rose::DB::Object aim for extremely fast and extensible/flexible enough

I discussed merging the projects with jcs a while back but he didn't see the
point of the ResultSet chaining system, which I consider DBIC's key killer
feature - until you've used it you don't realise it's something every other
ORM is missing (see Paul Graham's lisp vs. blub articles).

Personally, I see this as a great shame - for want of jcs understanding the
use of one feature, the chance to have a single project was lost.

In the meantime, RDBO is a brilliantly well-written system and if you're with
jcs in not seeing the point of the (functional-ish/set-arithmetic-ish resultset
concept) and not wanting to be able to subclass to override at any level of
the process, it's a very useful option.

I usually tell people to examine both and choose whichever best suits their
project - the experienced developers seem -usually- to end up going for 
DBIx::Class by default, Rose::DB::Object when they need speed over features
but that's my personal experience from discussion with a few hundred perl
developers, not a statement of intent/recommendation.
Rose::DB::Object

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/