Re: RFI: Database URIs

Gisle Aas <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <CAMx+QJ4q5k8=uX9GGMgm3=EJLzZ5uHdwgN-Nh-EU=mP5Tke8dA@mail.gmail.com>
I do find the "db:" prefix ugly.  If you want users to see these strings I
would think they find this prefix to be clutter too.

You seem to be alone in calling it "pg:".  For the other examples out there
I see "postgresql:" or "postgres:".  Should all different ways be allowed
and lead to the same thing?  I've seen both "mysql:" and "mysql2:". What
about "mariadb:"?

For sqlite:-URLs people seem to disagree on how to specify relative vs
absolute path names.

I wish there actually was _a_ standard for this stuff.  :-)

--Gisle



On Tue, Nov 26, 2013 at 7:14 PM, David E. Wheeler <[email protected]>wrote:

> On Nov 26, 2013, at 9:32 AM, Gisle Aas <[email protected]> wrote:
>
> > To me the value of database urls would be compatibility with other
> implementations of this obvious idea.  Some examples I found by quick
> googling:
> >
> >  http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls
> >
> http://docs.stackato.com/3.0/user/services/data-services.html#database-url
> >  https://github.com/kennethreitz/dj-database-url
> >  https://github.com/glenngillen/rails-database-url
> >  http://www.jguru.com/faq/view.jsp?EID=690
> >
> http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNSTRING
> >
> > It would be useful for somebody to survey these and then provide a perl
> module that's compatible with the consensus among these.  It would also be
> a good place to document what the state of database urls currently is.
>
> Thanks for those links They are all very similar (except for the rails
> one, which lacks docs). And they are similar to what I've come up with,
> detailed here:
>
>   https://github.com/theory/uri-db/blob/master/lib/URI/db.pm
>
> Basically, a database format is actually two URIs. The first is an opaque
> URI, "db:(.+)". The second URL is inside the "(.+)", and can take two forms:
>
>     $engine://$user:$pass@$host:$port$dbname?$params
>     $engine:$dbname?$params
>
> Some examples from the test suite:
>
>     db:
>     db:pg:
>     db:pg://localhost
>     db:pg://localhost:33
>     db:pg://foo:123/try?foo=1&foo=2&lol=yes
>     db:sqlite:
>     db:sqlite:foo.db
>     db:sqlite:/path/foo.db
>     db:sqlite:///path/foo.db
>     db:cubrid://localhost:33/foo
>     db:db2://localhost:33/foo
>     db:firebird://localhost:33/foo
>     db:informix:foo.db
>     db:informix:foo.db?foo=1
>     db:ingres:foo.db
>     db:ingres:foo.db?foo=1
>     db:interbase://localhost:33/foo
>     db:maxdb://localhost:33/foo
>     db:maxdb://localhost/foo
>     db:monetdb://localhost:1222?foo=1
>     db:monetdb://localhost/lolz
>     db:mysql://localhost:33/foo
>     db:oracle://localhost:33/foo
>     db:sqlserver://localhost:33/foo
>     db:sybase://localhost:33/foo
>     db:teradata://localhost
>     db:teradata://localhost:33/foo?hi=1
>     db:unify:foo.db
>     db:unify:
>     db:unify:?foo=1&bar=2
>     db:vertica:
>     db:vertica://localhost
>     db:vertica://localhost:33
>     db:vertica://foo:123/try?foo=1&foo=2&lol=yes
>
> I think it’s pretty simple and familiar, and plan to put it (or something
> similar, based on this and other discussions) in Sqitch.
>
> Thoughts?
>
> David
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.