in reply to Re^2: DBIx::Class and Google Fusion Tables
in thread DBIx::Class and Google Fusion Tables
There are a number of things I would need to know about your project to feel comfortable recommending one framework, module, or approach over another, but I'll try and explain DBIx::Class so you can make a decision on how to proceed.
First thing to do is to create the object code which will let you access the data and give you back DBIx::Class objects. In DBIx:Class, a table = a DBIx::Class::ResultSource. So what the commands below do is look at your database schemas and create the code which will let you access each table as a ResultSource. Great, now you have a way to get all of the objects (rows) from each ResultSource (table). Any time you ask the database for some data, you will now get back a DBIx::Class::ResultSet.
Now, in your application you can do whatever you need with each ResultSource - maybe you do some stuff in memory and print a report, maybe you create another database and import all of your data into a unified schema, I'm not sure what your goal is, but hopefully this helps you understand how DBIx::Class may help you.
dbicdump -o dump_directory=./lib -o preserve_case=1 MyApp::MySQLSchema + dbi:mysql:DB_Name user password dbicdump -o dump_directory=./lib -o preserve_case=1 MyApp::OracleSchem +a dbi:oracle:DB_Name user password
use MyApp::MySQLSchema ; use MyApp::OracleSchema ; our $schema_mysql = MyApp::MySQLSchema->connect( sub { # code that ret +urns a DBI handle } ) ; our $schema_oracle = MyApp::OracleSchema->connect( sub { # code that r +eturns another DBI handle } ) ; my $company = $schema_mysql->resultset('Company')->find($company_id) ; + # get 1 row/object my $widget = $company->find_related('widgets', $widget_id) ; # get 1 r +elated row/object my $parts = $widget->search_related('widget_parts', { in_stock => 1 }) + ; # get all matching related rows/object my $r = $widget->create_related('widget_part', { # create a row comments => $comments, creation_time => time(), }) ; $schema_mysql->txn_do( sub { $r->insert() ; $r->update() ; }) ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: DBIx::Class and Google Fusion Tables
by SineSwiper (Beadle) on Aug 29, 2011 at 23:25 UTC | |
by onelesd (Pilgrim) on Aug 30, 2011 at 00:02 UTC |