Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Non-retarded ORMs, and a general ORM discussions.

by diotalevi (Canon)
on Jun 16, 2006 at 21:12 UTC ( [id://555880]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Non-retarded ORMs, and a general ORM discussions.
in thread Non-retarded ORMs, and a general ORM discussions.

You need an example? It's just a method. There you go. This creates one schema object based on whatever is in your database.

To read a PostgreSQL database and create a schema that can be used by Alzabo. If you feel like it, it looks like there's a ->runtime_clone method on the Alzabo::Create::Schema object as well. You wouldn't use that for normal runtime but it might be convenient for your maintenance scripts.

my $schema = Alzabo::Create::Schema->reverse_engineer( name => ..., rdbms => "PostgreSQL", user => ..., password= > ... ); $schema->save_to_file; # I forget how the save directory is configured

Your runtime code:

my $schema = Alzabo::Runtime::Schema->load_from_file( name => ... );

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^4: Non-retarded ORMs, and a general ORM discussions.
by EvanCarroll (Chaplain) on Jun 16, 2006 at 21:46 UTC
    That was what I thought. I got an error, and I didn't do much research on it. No problem though, I'm thinking the DBIx schema loaders, and Rose::DB are better choices, I'm experimenting with them now..

    ecarroll@AMD64:~/code/perl/alzabo$ perl -MData::Dumper -MAlzabo::Creat +e::Schema -e'$_= Alzabo::Create::Schema->reverse_engineer(name => q/d +ealermade/,rdbms=> q/PostgreSQL/, user=> q/ecarroll/, password=>q/pas +sword/); print Dumper $_;' Table users already exists in schema Trace begun at /usr/local/share/perl/5.8.7/Alzabo/Create/Table.pm line + 65 Alzabo::Create::Table::set_name(undef, undef) called at /usr/local/sha +re/perl/5.8.7/Alzabo/Create/Table.pm line 39 Alzabo::Create::Table::new(undef, 'schema', 'Alzabo::Create::Schema=HA +SH(0x6012d0)', 'name', 'users') called at /usr/local/share/perl/5.8.7 +/Alzabo/Create/Schema.pm line 139 Alzabo::Create::Schema::make_table('Alzabo::Create::Schema=HASH(0x6012 +d0)', 'name', 'users') called at /usr/local/share/perl/5.8.7/Alzabo/R +DBMSRules/PostgreSQL.pm line 843 Alzabo::RDBMSRules::PostgreSQL::reverse_engineer('Alzabo::RDBMSRules:: +PostgreSQL=HASH(0xd39b10)', 'Alzabo::Create::Schema=HASH(0x6012d0)') +called at /usr/local/share/perl/5.8.7/Alzabo/Create/Schema.pm line 85 Alzabo::Create::Schema::reverse_engineer('Alzabo::Create::Schema', 'na +me', 'dealermade', 'rdbms', 'PostgreSQL', 'user', 'ecarroll', 'passwo +rd', 'password') called at -e line 1


    *note password is not going to stay 'password' for long


    Evan Carroll
    www.EvanCarroll.com
      Hello, Evan. I got similar problem you had then. Had you chosen ORM from CPAN, that satisfied your requirements? I've found Alzabo is good to try, but I also want persistence. I read about Tangram and SPOPS frameworks, but they doesn't support multiple column foreign keys.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://555880]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2024-04-24 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found