[ANN] PUnQLite NoSQL database project updated

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] PUnQLite NoSQL database project updated

Torsten Bergmann
Hi,

are you in need for really simple out of image persistency?

If you like to use a small RDBMS solution with Pharo then there is the embeddable SQLite
shared library and NBSQLite3 project [1] to access it. Combine it with Glorp [2] and you do
not have to fight too much with SQL.

On the other end of persistency world there are the so called "NoSQL databases" and beside
Mongo and all the others that require special setup etc. there is this wonderful small UnQLite
embeddable database [3] that similar to SQlite world only requires a simple library.

Thanks to Masashi Umezawa there is a nice wrapper for Pharo already to access this
tiny embeddable NoSQL database called "PUnQLite" [4] and [5], also including access to
the Jx9 machinery of UnQLite. It is really cool that he made this available.

This week I updated "PUnQLite" a little bit:
   - refactored the Native boost wrapper for UnQLite (using shared pools, ...)
   - documented classes
   - added a help topic
   - fixed a bug in cursors when accessing the keys in an empty database
   - and finally added a small spec based tool to work with a database file (see attached screenshot)
     One can use it to open an unqlite database, show the key value pairs and remove or add entries.

If you are in latest Pharo 4 already you can load all of that right from the config browser. Be aware
that you need the external unqlite shared library which is downloaded and extracted into a folder
"pharo-vm" when loading the config.

For instance on Windows it automagically downloads a file "pharo-vm/unqlite.dll" below your
image directory and you just have to copy this shared library file to the folder where your
VM (Pharo.exe) resides. Havent tried on other OS platforms.

From the Pharo side using the UnQLite database basically works like having some kind
"external dictionary" in a database file. Just run that in a workspace:

|db|
db := PqDatabase open: 'comments.db'.
db disableAutoCommit.
db transact: [
Object subclasses do: [:cls | | key |
    key := cls asString.
    db at: key put: cls comment ]
].
db close.

Then open the "Database Browser" from the world menu and open the "comments.db" file.
You can browse the keys and values, remove entries or add new. A filter for the keys
is also included. Nothing fancy but hope you like it or find it usable.

Couldnt make it to PharoConf 2015 but I hope all participants enjoy their time there.
Keep the others updated by using the #pharodays2015 on Twitter. Have fun!

Bye
T.


[1] http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2015-January/104720.html
[2] http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2015-January/015809.html
[3] http://unqlite.org/
[4] https://github.com/mumez/PunQLite
[5] http://smalltalkhub.com/#!/~MasashiUmezawa/PunQLite

screen.png (158K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] PUnQLite NoSQL database project updated

Peter Kenny
Hi Torsten

This looks very interesting. I am looking at a project which needs simple persistence, and I was considering MongoDB plus Voyage, which looked like overkill. I shall definitely be trying PUnQLite.

I am not yet on Pharo 4; I am using Moose 5.0, which is essentially Pharo 3. To load PUnQLite, I used the Gofer script on GitHub, the only problem being that the config did not load the PunQLite-Tools package; I got that separately by using the Monticello browser.

My main purpose here is to tell you about a problem I found when running the 'comments.db' example below. The database was generated as expected, but when I used the Database Browser to examine the results, I found that trying to display the comment for some classes caused a PqFetchError. It affects only a small proportion of classes; going through the alphabetical list in the browser, the first three classes affected are AbstractDistributionMap, AbstractEcryptorDecryptor (sic) and AbstractTimeZone. One curiosity is that, once the debugger window has popped up for one entry and been closed down, the same window appears whichever other entry is selected next.

I have deleted and recreated the 'comments.db' file to see if that would clear the problem, but it persisted. This disclosed another curiosity. The 'choose a .db' window that pops up when opening the Database Browser has a button to delete a file, but it did not delete my database file when I tried it; I had to close down Pharo to free the file and then use Windows Explorer.

It seems that the problem is one which affects the Database Browser only; I tried a snippet in a workspace which opened the comments.db database and retrieved the entry for AbstractDistributionMap, and it worked correctly.

I hope this is enough detail for you to investigate; if not, come back to me.

Best wishes

Peter Kenny


-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of Torsten Bergmann
Sent: 29 January 2015 08:20
To: Any question about pharo is welcome; Pharo Development List
Cc: [hidden email]
Subject: [Pharo-users] [ANN] PUnQLite NoSQL database project updated

Hi,

are you in need for really simple out of image persistency?

If you like to use a small RDBMS solution with Pharo then there is the embeddable SQLite shared library and NBSQLite3 project [1] to access it. Combine it with Glorp [2] and you do not have to fight too much with SQL.

On the other end of persistency world there are the so called "NoSQL databases" and beside Mongo and all the others that require special setup etc. there is this wonderful small UnQLite embeddable database [3] that similar to SQlite world only requires a simple library.

Thanks to Masashi Umezawa there is a nice wrapper for Pharo already to access this tiny embeddable NoSQL database called "PUnQLite" [4] and [5], also including access to the Jx9 machinery of UnQLite. It is really cool that he made this available.

This week I updated "PUnQLite" a little bit:
   - refactored the Native boost wrapper for UnQLite (using shared pools, ...)
   - documented classes
   - added a help topic
   - fixed a bug in cursors when accessing the keys in an empty database
   - and finally added a small spec based tool to work with a database file (see attached screenshot)
     One can use it to open an unqlite database, show the key value pairs and remove or add entries.

If you are in latest Pharo 4 already you can load all of that right from the config browser. Be aware that you need the external unqlite shared library which is downloaded and extracted into a folder "pharo-vm" when loading the config.

For instance on Windows it automagically downloads a file "pharo-vm/unqlite.dll" below your image directory and you just have to copy this shared library file to the folder where your VM (Pharo.exe) resides. Havent tried on other OS platforms.

From the Pharo side using the UnQLite database basically works like having some kind "external dictionary" in a database file. Just run that in a workspace:

|db|
db := PqDatabase open: 'comments.db'.
db disableAutoCommit.
db transact: [
Object subclasses do: [:cls | | key |
    key := cls asString.
    db at: key put: cls comment ]
].
db close.

Then open the "Database Browser" from the world menu and open the "comments.db" file.
You can browse the keys and values, remove entries or add new. A filter for the keys is also included. Nothing fancy but hope you like it or find it usable.

Couldnt make it to PharoConf 2015 but I hope all participants enjoy their time there.
Keep the others updated by using the #pharodays2015 on Twitter. Have fun!

Bye
T.


[1] http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2015-January/104720.html
[2] http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2015-January/015809.html
[3] http://unqlite.org/
[4] https://github.com/mumez/PunQLite
[5] http://smalltalkhub.com/#!/~MasashiUmezawa/PunQLite


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] [ANN] PUnQLite NoSQL database project updated

Tudor Girba-2
In reply to this post by Torsten Bergmann
Hi Torsten,

This sounds very interesting.

I tried to play with it on Mac, but I got a bit stuck. Here is what I did:

- I downloaded the UnQLite sources from:

- In that folder I did:
gcc -m32 -c unqlite.c
gcc -m32 -dynamiclib -o unqlite.dylib unqlite.o

- I then copied the unqlite.dylib file in the plugins folder:
Pharo.app/Contents/MacOS/Plugins

- I started a Pharo 4 image with the corresponding VM

- I loaded the stable version of PUnQLite from the ConfigurationBrowser

- I executed without errors the code you mentioned:
|db|
db := PqDatabase open: 'comments.db'.
db disableAutoCommit.
db transact: [
Object subclasses do: [:cls | | key |
    key := cls asString.
    db at: key put: cls comment ]
].
db close.

==> However I do not get a comments.db file/folder, and the Database Browser does not show anything.

Am I doing something wrong?

Cheers,
Doru


On Thu, Jan 29, 2015 at 9:20 AM, Torsten Bergmann <[hidden email]> wrote:
Hi,

are you in need for really simple out of image persistency?

If you like to use a small RDBMS solution with Pharo then there is the embeddable SQLite
shared library and NBSQLite3 project [1] to access it. Combine it with Glorp [2] and you do
not have to fight too much with SQL.

On the other end of persistency world there are the so called "NoSQL databases" and beside
Mongo and all the others that require special setup etc. there is this wonderful small UnQLite
embeddable database [3] that similar to SQlite world only requires a simple library.

Thanks to Masashi Umezawa there is a nice wrapper for Pharo already to access this
tiny embeddable NoSQL database called "PUnQLite" [4] and [5], also including access to
the Jx9 machinery of UnQLite. It is really cool that he made this available.

This week I updated "PUnQLite" a little bit:
   - refactored the Native boost wrapper for UnQLite (using shared pools, ...)
   - documented classes
   - added a help topic
   - fixed a bug in cursors when accessing the keys in an empty database
   - and finally added a small spec based tool to work with a database file (see attached screenshot)
     One can use it to open an unqlite database, show the key value pairs and remove or add entries.

If you are in latest Pharo 4 already you can load all of that right from the config browser. Be aware
that you need the external unqlite shared library which is downloaded and extracted into a folder
"pharo-vm" when loading the config.

For instance on Windows it automagically downloads a file "pharo-vm/unqlite.dll" below your
image directory and you just have to copy this shared library file to the folder where your
VM (Pharo.exe) resides. Havent tried on other OS platforms.

From the Pharo side using the UnQLite database basically works like having some kind
"external dictionary" in a database file. Just run that in a workspace:

|db|
db := PqDatabase open: 'comments.db'.
db disableAutoCommit.
db transact: [
Object subclasses do: [:cls | | key |
    key := cls asString.
    db at: key put: cls comment ]
].
db close.

Then open the "Database Browser" from the world menu and open the "comments.db" file.
You can browse the keys and values, remove entries or add new. A filter for the keys
is also included. Nothing fancy but hope you like it or find it usable.

Couldnt make it to PharoConf 2015 but I hope all participants enjoy their time there.
Keep the others updated by using the #pharodays2015 on Twitter. Have fun!

Bye
T.


[1] http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2015-January/104720.html
[2] http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2015-January/015809.html
[3] http://unqlite.org/
[4] https://github.com/mumez/PunQLite
[5] http://smalltalkhub.com/#!/~MasashiUmezawa/PunQLite



--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] PUnQLite NoSQL database project updated

Pierce Ng-3
In reply to this post by Peter Kenny
On Thu, Jan 29, 2015 at 06:09:41PM -0000, PBKResearch wrote:
> This looks very interesting. I am looking at a project which needs simple
> persistence, and I was considering MongoDB plus Voyage, which looked like
> overkill. I shall definitely be trying PUnQLite.

You might want to try SimplePersistence, also maintained by Torsten. Pure
Smalltalk, uses Fuel, no FFI.

  http://www.smalltalkhub.com/#!/~TorstenBergmann/SimplePersistence