The Perl Advent Calendar needs more articles for 2022. Submit your idea today!


DBIx::Skinny::ProxyTable - handling dynamic table for DBIx::Skinny


  package Proj::DB;
  use DBIx::Skinny;
  use DBIx::Skinny::Mixin modules => [qw(ProxyTable)];

  package Proj::DB::Schema;
  use DBIx::Skinny::Schema;
  use DBIx::Skinny::Schema::ProxyTableRule;

  install_table 'access_log' => shcema {
    proxy_table_rule 'named_strftime', 'access_log_%Y%m', 'accessed_on';

    pk 'id';
    columns qw/id/;

  package main;

  my $rule = Proj::DB->proxy_table->rule('access_log', accessed_on => DateTime->today);
  $rule->table_name; #=> "access_log_200901"

  my $iter = Proj::DB->search($rule->table_name, { foo => 'bar' });

  # or you can call manually. ( NOT RECOMMEND )
  Proj::DB->proxy_table->set(access_log => "access_log_200901");
  Proj::DB->proxy_table->copy_table(access_log => "access_log_200901");


DBIx::Skinny::ProxyTable is DBIx::Skinny::Mixin for partitioning table.


set($from, $to)

set schema information for table that name is $to based on $from to your project skinny's schema. I don't recommend to call this method directly because of distributing naming rule.

see also rule method.

copy_table($from, $to)

copy table from $from to $to if it $to is not exist. SQLite and MySQL only support.

rule($from, @args)

create DBIx::Skinny::ProxyTable::Rule object. @args is followed by your project skinny's schema definition.

see also DBIx::Skinny::ProxyTable::Rule


Keiji Yoshimi <walf443 at gmail dot com>


DBIx::Skinny, DBIx::Class::ProxyTable


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.