Hi,
I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo. https://github.com/svenvc/P3 Version 1.1 contains the following changes: - added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) - added P3-Tests package and moved all tests there - more comments - more unit tests https://github.com/svenvc/P3/releases/tag/v1.1 Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements. Here is an example doing a batch insert of 100 records (which is more efficient). | client statement | client := P3Client url: 'psql://sven@localhost'. client execute: 'DROP TABLE IF EXISTS table1'. client execute: 'CREATE TABLE table1 (id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), name TEXT)'. statement := client prepare: 'INSERT INTO table1 (name) VALUES ($1)'. statement executeBatch: ((1 to: 100) collect: [ :index | Array with: ('Text #', index printString) ]). client query: 'SELECT * FROM table1'. client execute: 'DROP TABLE table1'. statement close. client close. Season's Greetings to you all. Sven -- Sven Van Caekenberghe Proudly supporting Pharo http://pharo.org http://association.pharo.org http://consortium.pharo.org |
On Mon, 31 Dec 2018 at 19:34, Sven Van Caekenberghe <[hidden email]> wrote: Hi, This is great to hear. Could you advise what functionality remains missing, and what priority you'd consider each is? cheers -ben |
> On 1 Jan 2019, at 02:12, Ben Coman <[hidden email]> wrote: > > > > On Mon, 31 Dec 2018 at 19:34, Sven Van Caekenberghe <[hidden email]> wrote: > Hi, > > I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo. > > https://github.com/svenvc/P3 > > Version 1.1 contains the following changes: > > - added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) > - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) > - added P3-Tests package and moved all tests there > - more comments > - more unit tests > > https://github.com/svenvc/P3/releases/tag/v1.1 > > > Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements. > > This is great to hear. Could you advise what functionality remains missing, and what priority you'd consider each is? > > cheers -ben From its initial release, P3 covered enough to support GLORP, a complex object relational mapper with hundreds of unit tests. After that several new features and support for more primitive types was added. So overall, we are in a good place, and P3 is fully functional and useable for real applications. At the protocol level, I think the most important missing part is probably COPY support. Regarding primitive types, PostgreSQL is a bit special in the fact that it has a large, even infinite amount of primitive types, that are extensible by both plugins and users. P3 currently supports the following 26 primitive types: #(#_bool #_float8 #_int4 #_text #_varchar #bool #bpchar #bytea #date #float4 #float8 #int2 #int4 #int8 #json #jsonb #name #numeric #oid #text #time #timestamp #timestamptz #uuid #varchar #void) These are internal PG specific type names, some types have better know aliases. On my machine, pg_type contains more than 600 types though ! Do we need them all ? No. But there will be use cases where people ask for more types, most should be pretty easy to add. Like for all open source code, the best scenario is to have lots of users, so that the code can be improved where needed to become truly battle tested. Sven |
In reply to this post by Sven Van Caekenberghe-2
Very cool. Thanks!
Doru > On Dec 31, 2018, at 12:33 PM, Sven Van Caekenberghe <[hidden email]> wrote: > > Hi, > > I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo. > > https://github.com/svenvc/P3 > > Version 1.1 contains the following changes: > > - added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) > - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) > - added P3-Tests package and moved all tests there > - more comments > - more unit tests > > https://github.com/svenvc/P3/releases/tag/v1.1 > > > Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements. > > Here is an example doing a batch insert of 100 records (which is more efficient). > > | client statement | > > client := P3Client url: 'psql://sven@localhost'. > > client execute: 'DROP TABLE IF EXISTS table1'. > client execute: 'CREATE TABLE table1 (id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), name TEXT)'. > > statement := client prepare: 'INSERT INTO table1 (name) VALUES ($1)'. > statement executeBatch: ((1 to: 100) collect: [ :index | Array with: ('Text #', index printString) ]). > > client query: 'SELECT * FROM table1'. > client execute: 'DROP TABLE table1'. > > statement close. > client close. > > > Season's Greetings to you all. > > Sven > > > -- > Sven Van Caekenberghe > Proudly supporting Pharo > http://pharo.org > http://association.pharo.org > http://consortium.pharo.org > > > > -- www.feenk.com "To utilize feedback, you first have to acquire it." |
Thanks Sven :) On Tue, Jan 1, 2019 at 11:54 PM Tudor Girba via Pharo-users <[hidden email]> wrote: Very cool. Thanks!
|
In reply to this post by Sven Van Caekenberghe-2
You can now query a Postgres database from the new GT. The initial code is available here:
It currently looks like this: Cheers, Doru On Dec 31, 2018, at 12:33 PM, Sven Van Caekenberghe <[hidden email]> wrote: |
very cool. thanks Doru & team. cheers -ben On Sat, 5 Jan 2019 at 07:02, Tudor Girba <[hidden email]> wrote:
|
In reply to this post by Tudor Girba-2
Beautiful.
> On 5 Jan 2019, at 00:02, Tudor Girba <[hidden email]> wrote: > > You can now query a Postgres database from the new GT. The initial code is available here: > https://github.com/feenkcom/gt4p3 > > It currently looks like this: > <gt-inspector-p3-query.png> > > Cheers, > Doru > > > >> On Dec 31, 2018, at 12:33 PM, Sven Van Caekenberghe <[hidden email]> wrote: >> >> Hi, >> >> I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo. >> >> https://github.com/svenvc/P3 >> >> Version 1.1 contains the following changes: >> >> - added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) >> - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) >> - added P3-Tests package and moved all tests there >> - more comments >> - more unit tests >> >> https://github.com/svenvc/P3/releases/tag/v1.1 >> >> >> Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements. >> >> Here is an example doing a batch insert of 100 records (which is more efficient). >> >> | client statement | >> >> client := P3Client url: 'psql://sven@localhost'. >> >> client execute: 'DROP TABLE IF EXISTS table1'. >> client execute: 'CREATE TABLE table1 (id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), name TEXT)'. >> >> statement := client prepare: 'INSERT INTO table1 (name) VALUES ($1)'. >> statement executeBatch: ((1 to: 100) collect: [ :index | Array with: ('Text #', index printString) ]). >> >> client query: 'SELECT * FROM table1'. >> client execute: 'DROP TABLE table1'. >> >> statement close. >> client close. >> >> >> Season's Greetings to you all. >> >> Sven >> >> >> -- >> Sven Van Caekenberghe >> Proudly supporting Pharo >> http://pharo.org >> http://association.pharo.org >> http://consortium.pharo.org >> >> >> >> > > -- > www.feenk.com > > "What is more important: To be happy, or to make happy?" > |
In reply to this post by Tudor Girba-2
And with a little more code, we now have a dedicated Playground form snippet that opens the database connection without requiring any Pharo code.
Cheers, Doru On Jan 5, 2019, at 12:02 AM, Tudor Girba <[hidden email]> wrote: |
Nice, I just added convenience methods #listDatabases #listSchemas and #listTablesInSchema: to P3Client so you should be able to make a real browser, connection >> schemas >> tables >> contents (listDatabases is not so useful since you can only connect to 1 database at a time).
> On 6 Jan 2019, at 00:01, Tudor Girba <[hidden email]> wrote: > > And with a little more code, we now have a dedicated Playground form snippet that opens the database connection without requiring any Pharo code. > > <gt4p3-snippet.png> > > Cheers, > Doru > > >> On Jan 5, 2019, at 12:02 AM, Tudor Girba <[hidden email]> wrote: >> >> You can now query a Postgres database from the new GT. The initial code is available here: >> https://github.com/feenkcom/gt4p3 >> >> It currently looks like this: >> <gt-inspector-p3-query.png> >> >> Cheers, >> Doru >> >> >> >>> On Dec 31, 2018, at 12:33 PM, Sven Van Caekenberghe <[hidden email]> wrote: >>> >>> Hi, >>> >>> I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo. >>> >>> https://github.com/svenvc/P3 >>> >>> Version 1.1 contains the following changes: >>> >>> - added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) >>> - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) >>> - added P3-Tests package and moved all tests there >>> - more comments >>> - more unit tests >>> >>> https://github.com/svenvc/P3/releases/tag/v1.1 >>> >>> >>> Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements. >>> >>> Here is an example doing a batch insert of 100 records (which is more efficient). >>> >>> | client statement | >>> >>> client := P3Client url: 'psql://sven@localhost'. >>> >>> client execute: 'DROP TABLE IF EXISTS table1'. >>> client execute: 'CREATE TABLE table1 (id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), name TEXT)'. >>> >>> statement := client prepare: 'INSERT INTO table1 (name) VALUES ($1)'. >>> statement executeBatch: ((1 to: 100) collect: [ :index | Array with: ('Text #', index printString) ]). >>> >>> client query: 'SELECT * FROM table1'. >>> client execute: 'DROP TABLE table1'. >>> >>> statement close. >>> client close. >>> >>> >>> Season's Greetings to you all. >>> >>> Sven >>> >>> >>> -- >>> Sven Van Caekenberghe >>> Proudly supporting Pharo >>> http://pharo.org >>> http://association.pharo.org >>> http://consortium.pharo.org >>> >>> >>> >>> >> >> -- >> www.feenk.com >> >> "What is more important: To be happy, or to make happy?" >> > > -- > www.feenk.com > > "Quality cannot be an afterthought." > |
Excellent.
In the meantime, we extended GT4P3 a bit to also navigate Schemas and Tables' structure. For this, I introduced a few classes such as Database, Schema or Table to ease the inspection and tool creation. It’s a bit naive for now, but it works quite well. Should these be committed to the P3 directly to enable an object-oriented API for drilling through the DB? Cheers, Doru On Jan 6, 2019, at 9:17 PM, Sven Van Caekenberghe via Pharo-users <[hidden email]> wrote: |
In reply to this post by Pharo Smalltalk Users mailing list
> On 7 Jan 2019, at 20:30, Tudor Girba <[hidden email]> wrote: > > Excellent. > > In the meantime, we extended GT4P3 a bit to also navigate Schemas and Tables' structure. > <gt4p3-schema-tables.png> > > For this, I introduced a few classes such as Database, Schema or Table to ease the inspection and tool creation. It’s a bit naive for now, but it works quite well. Should these be committed to the P3 directly to enable an object-oriented API for drilling through the DB? Yes, that is what I meant. I looked at your code (https://github.com/feenkcom/gt4p3) and I understand the reification. But like you say, the usefulness of these objects beyond this exploration is questionable. One of the goals of P3 is to be lean and mean, to not offer much framework in how you should make use of it, that should be done by another layer like Glorp. We'll see how this evolve going forward. > Cheers, > Doru > > > >> On Jan 6, 2019, at 9:17 PM, Sven Van Caekenberghe via Pharo-users <[hidden email]> wrote: >> >> >> From: Sven Van Caekenberghe <[hidden email]> >> Subject: Re: [Pharo-users] [ANN] P3 version 1.1 >> Date: January 6, 2019 at 9:17:34 PM GMT+1 >> To: Any question about pharo is welcome <[hidden email]> >> >> >> Nice, I just added convenience methods #listDatabases #listSchemas and #listTablesInSchema: to P3Client so you should be able to make a real browser, connection >> schemas >> tables >> contents (listDatabases is not so useful since you can only connect to 1 database at a time). >> >>> On 6 Jan 2019, at 00:01, Tudor Girba <[hidden email]> wrote: >>> >>> And with a little more code, we now have a dedicated Playground form snippet that opens the database connection without requiring any Pharo code. >>> >>> <gt4p3-snippet.png> >>> >>> Cheers, >>> Doru >>> >>> >>>> On Jan 5, 2019, at 12:02 AM, Tudor Girba <[hidden email]> wrote: >>>> >>>> You can now query a Postgres database from the new GT. The initial code is available here: >>>> https://github.com/feenkcom/gt4p3 >>>> >>>> It currently looks like this: >>>> <gt-inspector-p3-query.png> >>>> >>>> Cheers, >>>> Doru >>>> >>>> >>>> >>>>> On Dec 31, 2018, at 12:33 PM, Sven Van Caekenberghe <[hidden email]> wrote: >>>>> >>>>> Hi, >>>>> >>>>> I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo. >>>>> >>>>> https://github.com/svenvc/P3 >>>>> >>>>> Version 1.1 contains the following changes: >>>>> >>>>> - added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) >>>>> - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) >>>>> - added P3-Tests package and moved all tests there >>>>> - more comments >>>>> - more unit tests >>>>> >>>>> https://github.com/svenvc/P3/releases/tag/v1.1 >>>>> >>>>> >>>>> Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements. >>>>> >>>>> Here is an example doing a batch insert of 100 records (which is more efficient). >>>>> >>>>> | client statement | >>>>> >>>>> client := P3Client url: 'psql://sven@localhost'. >>>>> >>>>> client execute: 'DROP TABLE IF EXISTS table1'. >>>>> client execute: 'CREATE TABLE table1 (id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), name TEXT)'. >>>>> >>>>> statement := client prepare: 'INSERT INTO table1 (name) VALUES ($1)'. >>>>> statement executeBatch: ((1 to: 100) collect: [ :index | Array with: ('Text #', index printString) ]). >>>>> >>>>> client query: 'SELECT * FROM table1'. >>>>> client execute: 'DROP TABLE table1'. >>>>> >>>>> statement close. >>>>> client close. >>>>> >>>>> >>>>> Season's Greetings to you all. >>>>> >>>>> Sven >>>>> >>>>> >>>>> -- >>>>> Sven Van Caekenberghe >>>>> Proudly supporting Pharo >>>>> http://pharo.org >>>>> http://association.pharo.org >>>>> http://consortium.pharo.org >>>>> >>>>> >>>>> >>>>> >>>> >>>> -- >>>> www.feenk.com >>>> >>>> "What is more important: To be happy, or to make happy?" >>>> >>> >>> -- >>> www.feenk.com >>> >>> "Quality cannot be an afterthought." >>> >> >> >> >> > > -- > www.feenk.com > > "No matter how many recipes we know, we still value a chef." |
Perfect. Then I will continue in our repo and we see later.
Doru > On Jan 9, 2019, at 9:36 PM, Sven Van Caekenberghe <[hidden email]> wrote: > > > >> On 7 Jan 2019, at 20:30, Tudor Girba <[hidden email]> wrote: >> >> Excellent. >> >> In the meantime, we extended GT4P3 a bit to also navigate Schemas and Tables' structure. >> <gt4p3-schema-tables.png> >> >> For this, I introduced a few classes such as Database, Schema or Table to ease the inspection and tool creation. It’s a bit naive for now, but it works quite well. Should these be committed to the P3 directly to enable an object-oriented API for drilling through the DB? > > Yes, that is what I meant. > I looked at your code (https://github.com/feenkcom/gt4p3) and I understand the reification. > But like you say, the usefulness of these objects beyond this exploration is questionable. > One of the goals of P3 is to be lean and mean, to not offer much framework in how you should make use of it, that should be done by another layer like Glorp. > We'll see how this evolve going forward. > >> Cheers, >> Doru >> >> >> >>> On Jan 6, 2019, at 9:17 PM, Sven Van Caekenberghe via Pharo-users <[hidden email]> wrote: >>> >>> >>> From: Sven Van Caekenberghe <[hidden email]> >>> Subject: Re: [Pharo-users] [ANN] P3 version 1.1 >>> Date: January 6, 2019 at 9:17:34 PM GMT+1 >>> To: Any question about pharo is welcome <[hidden email]> >>> >>> >>> Nice, I just added convenience methods #listDatabases #listSchemas and #listTablesInSchema: to P3Client so you should be able to make a real browser, connection >> schemas >> tables >> contents (listDatabases is not so useful since you can only connect to 1 database at a time). >>> >>>> On 6 Jan 2019, at 00:01, Tudor Girba <[hidden email]> wrote: >>>> >>>> And with a little more code, we now have a dedicated Playground form snippet that opens the database connection without requiring any Pharo code. >>>> >>>> <gt4p3-snippet.png> >>>> >>>> Cheers, >>>> Doru >>>> >>>> >>>>> On Jan 5, 2019, at 12:02 AM, Tudor Girba <[hidden email]> wrote: >>>>> >>>>> You can now query a Postgres database from the new GT. The initial code is available here: >>>>> https://github.com/feenkcom/gt4p3 >>>>> >>>>> It currently looks like this: >>>>> <gt-inspector-p3-query.png> >>>>> >>>>> Cheers, >>>>> Doru >>>>> >>>>> >>>>> >>>>>> On Dec 31, 2018, at 12:33 PM, Sven Van Caekenberghe <[hidden email]> wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> I created a new release of P3, the modern, lean and mean PostgreSQL client for Pharo. >>>>>> >>>>>> https://github.com/svenvc/P3 >>>>>> >>>>>> Version 1.1 contains the following changes: >>>>>> >>>>>> - added support for Postgres Extended Query protocol (P3PreparedStatement) (thx Jan @jvdsandt) >>>>>> - added support for reading array type values (currently INTEGER[] FLOAT[] BOOLEAN[] TEXT[] VARCHAR[]) >>>>>> - added P3-Tests package and moved all tests there >>>>>> - more comments >>>>>> - more unit tests >>>>>> >>>>>> https://github.com/svenvc/P3/releases/tag/v1.1 >>>>>> >>>>>> >>>>>> Especially Jan's contribution adds a lot of functionality: the ability to work with prepared statements. >>>>>> >>>>>> Here is an example doing a batch insert of 100 records (which is more efficient). >>>>>> >>>>>> | client statement | >>>>>> >>>>>> client := P3Client url: 'psql://sven@localhost'. >>>>>> >>>>>> client execute: 'DROP TABLE IF EXISTS table1'. >>>>>> client execute: 'CREATE TABLE table1 (id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), name TEXT)'. >>>>>> >>>>>> statement := client prepare: 'INSERT INTO table1 (name) VALUES ($1)'. >>>>>> statement executeBatch: ((1 to: 100) collect: [ :index | Array with: ('Text #', index printString) ]). >>>>>> >>>>>> client query: 'SELECT * FROM table1'. >>>>>> client execute: 'DROP TABLE table1'. >>>>>> >>>>>> statement close. >>>>>> client close. >>>>>> >>>>>> >>>>>> Season's Greetings to you all. >>>>>> >>>>>> Sven >>>>>> >>>>>> >>>>>> -- >>>>>> Sven Van Caekenberghe >>>>>> Proudly supporting Pharo >>>>>> http://pharo.org >>>>>> http://association.pharo.org >>>>>> http://consortium.pharo.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> -- >>>>> www.feenk.com >>>>> >>>>> "What is more important: To be happy, or to make happy?" >>>>> >>>> >>>> -- >>>> www.feenk.com >>>> >>>> "Quality cannot be an afterthought." >>>> >>> >>> >>> >>> >> >> -- >> www.feenk.com >> >> "No matter how many recipes we know, we still value a chef." > -- www.feenk.com “Live like you mean it." |
Free forum by Nabble | Edit this page |