Martijn Durnez Tue May 01 08:42:33 -0400 2012

Subject: Google Fusion Tables adapter

I thought it'd be cool to write an adapter for the Google Fusion Tables api (https://developers.google.com/fusiontables/) since it's SQL based.

I used http://code.google.com/p/fusion-tables-client-php/ as a starting point.

The adapter is located @ https://github.com/Tieno/php-activerecord/blob/master/lib/adapters/FusionAdapter.php

Selects, updates and inserts seem to work. Associations work so far as I don't eager load them. When I use eager loading ('include') then it starts to use the table primary_key (always the rowid) as a primary_key for the association. Don't know why.

So far it feels cobbled together and I could use some advice/input/help from more knowledgable people.

To test it it set a connection like so.

$cfg->set_connections(array(
'development' => 'fusion://gmailadres:gmailpassword@localhost/db'
));

Locahost and db aren't used.
in your model you need to explicitly set your table name (ie your google fusion table_id) like so

static $table = '1D_y1NUtWphmbSGe0jHp3Opqf3qQckyl66fBNMg';

for https://www.google.com/fusiontables/DataSource?docid=1D_y1NUtWphmbSGe0jHp3Opqf3qQckyl66fBNMg