[Dbix-class] Different Read and Write Database Handles Supported within DBIx?
Matija Grabnar
matija at literal.si
Tue May 2 19:46:57 CEST 2006
Nathanial Hendler wrote:
> In my situation, I have a setup of one master and many slave databases.
> Each slave is used for reading, and the master is used to write to.
> Does DBIx::Class support this environment? Can I create a single object
> and interact with it normally and DBIx knows that
> INSERTs/UPDATEs/DELETEs happen on database server A, and SELECTs happen
> on database server B?
>
> Any suggestions would be appreciated.
>
I don't remember seeing anything like that in any DBIC docs. However, if
you use an explicit schema with your DBIC class, you can have multiple
"schema handles", each with it's own connection data. So for your
situation, you could have an array of "read-only" schemas and one
"read-write" schema.
Unfortunately, from what I can see, your code would have to decide which
is appropriate to use when - this level of automation does not seem to
be present in DBIx::Class.
More information about the Dbix-class
mailing list