mojolicious / mojo-pg

Mojolicious :heart: PostgreSQL
https://metacpan.org/release/Mojo-Pg
Artistic License 2.0
99 stars 46 forks source link

Separating SQL::Abstract::Pg Into its own Distro? #67

Closed mikkoi closed 4 years ago

mikkoi commented 4 years ago

I am using SQL::Abstract::Pg without Mojolicious directly with DBI. So the other dependencies seem like extra weight. Would it be possible to separate SQL::Abstract::Pg into its own distro and remove the need for Mojolicous, specifically Mojo::Base which is used to load SQL::Abstract?

kraih commented 4 years ago

I'm not particularly keen on the maintenance overhead. Especially since SQL::Abstract::Pg is technically a Mojolicious spin-off module (and has to follow all the usual rules). But i'll leave this issue open so we can see if others care.

That said, if you're using SQL::Abstract you're already pulling half of CPAN into your project, so Mojo::Base should be the least of your worries. 😉

Grinnz commented 4 years ago

I would like to make a common SQL::Abstract extension module that both Mojo::Pg and Mojo::SQLite (and others) can use, but IIRC neither @kraih nor @shadowcat-mst were very keen on the idea.

kraih commented 4 years ago

That reminds me, SQL::Abstract::Pg has very Mojo::Pg specific features, like the -json operator.

kraih commented 4 years ago

To be honest, i was really hoping to give back features like LIMIT/OFFSET support upstream to SQL::Abstract. Since it works in all major open source databases the same. But there was simply zero interest, and at this point i only really care about Mojo::Pg.

mikkoi commented 4 years ago

SQL::Abstract is not so heavy. I created a test case and run scandeps.pl (Module::ScanDeps) on it.

use SQL::Abstract;
my ($stmt, @bind) = SQL::Abstract->new->select('test_table',
    [ qw( id ver code ) ], { id => 'ID_1', ver => 3, });
print "Statement:$stmt:\n";
print 'bind:', (join ',', @bind), "\n";
scandeps.pl ./test-sql-abstract.pl 
'List::Util'    => '1.53',
'MRO::Compat'   => '0.13',
'SQL::Abstract' => '1.86',
'Scalar::Util'  => '1.53',
'XSLoader'      => '0.24',
kraih commented 4 years ago

@mikkoi I have no idea what you're trying to say. But that doesn't even cover the deps listed on CPAN.

mikkoi commented 4 years ago

I only wanted to demonstrate that the actual SQL::Abstract functionality is not dependent on much besides the core. The list of dependencies listed in CPAN has Moo but it is only used when pretty printing (SQL::Abstract::Tree).

kraih commented 4 years ago

Closing this issue since the discussion has gotten way off-topic.