Code Monkey home page Code Monkey logo

dbix-datamodel's People

Contributors

asolovey avatar damil avatar fedelippo avatar rjattrill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dbix-datamodel's Issues

using '-result_as'

When is it possible to use -result_as with select queries?

My use case: I create a statement object with an initial set of parameters and then add further -where parameters according to the values of some filters using $statement->refine. The last step is to output the results; depending on the type of output required, I might want a statement handle (-result_as => $sth) or a DBIx::DataModel::Statement object, i.e.

my $stt = $self->schema( $schema )->table( $table )->select( %args );
...
$stt->refine( -where => %where_args );
...
# ready to output
if ( $format eq 'csv' ) {
	# use a statement handle
	my $sth = ???; # !! is this possible?
#	output as CSV
#	$csv->print( $io, $sth->{NAME_lc} );
# 	...
}
else {
	# use DBIx::DataModel::Statement object
	...
}

Once I've created the initial $stt object, it is in status refined and I can only add more -where args at this point. If I try running $stt->reset I can get back to status new but adding the old arguments with -result_as => 'sth' still leaves me with a DBIx::DataModel::Statement object, not the statement handle that I'd like to use.

It's really useful to be able to call $stt->refine to add parameters to an existing query. Is there any way to get a DBI statement handle out of the DBIx::DataModel::Statement object?

Composition() produces a wrong list of components

Relationships between tables can be declared either as Association() or as Composition().
When choosing Composition(), a metadata list of "components" is generated. The algorithm for generating this list has a bug : it includes the composite class as a "component" of its ... component classes, therefore generating a circular structure.
In consequence the auto_expand($with_recursion) method generates an infinite loop.

Data::Dump chokes on DBIDM Output

When using Data::Dump https://metacpan.org/module/Data::Dump, dump on a DBIDM blessed hash will crash if the hash is a result of a join.

The offending string will look something like this:
activity|a<=>process|p<=>domain|d=
as part of
'My::Schema::AutoJoin::Task|t<=>activity|a<=>process|p<=>domain|d'

This is probably a bug on Data::Dump rather than DBIDM, but I putting here for tracking until I can generate a simple test case to log against Data::Dump

Ordering output from joined tables

Being able to pull data from related tables is very handy, but is there a way to add an ORDER BY clause without using $row->expand(), or have a default ORDER_BY clause as part of the association?

For example, I have an object with 20+ different compositions/associations to fetch; it would be very handy to set the order that i want each association fetched in as part of the data model.

(This is probably going beyond what DBIx::DataModel is meant for, but I was just wondering if it was possible without specifying it using $row->expand( 'association', ( -order_by => 'whatever' ) ).)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.