[ANN] Initial release of amalgalite - v0.1.0

Discussion in 'Ruby' started by Jeremy Hinegardner, Jun 22, 2008.

  1. Amalgalite embeds the SQLite database engine in a ruby extension.

    * http://www.copiousfreetime.org/projects/amalgalite/
    * http://copiousfreetime.org/articles/2008/06/21/amalgalite-0-1-0-released.html

    I would consider Amalgalite beta right now. It is fully usable; but it does not
    contain all the features I want yet.

    Give it a whirl and let me know what you think.

    Current Functionality
    --------------------

    The normal stuff:

    * open or create databases
    * run SQL in single statements or in batches.
    * use prepared statements with parameters
    * access result sets by index or by column name
    * transactions
    * type conversion between database types and Ruby types

    The fun/happy/cool stuff

    * trace information
    * profile information
    * read only databases
    * a type conversion protocol

    Future plans
    ------------

    * ActiveRecord driver
    * DataMapper driver
    * Sequel driver
    * progress and authorizer callbacks
    * 'amalgalite' command line tool similar to the 'sqlite3' command line tool
    * utf-16 support
    * blob support
    * and more

    {{ Release notes for Version 0.1.0 }}

    * Initial public release

    --
    ========================================================================
    Jeremy Hinegardner
     
    Jeremy Hinegardner, Jun 22, 2008
    #1
    1. Advertising

  2. Jeremy Hinegardner wrote:
    > Amalgalite embeds the SQLite database engine in a ruby extension.


    Is that really better than linking with libsqlite?

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
     
    Joel VanderWerf, Jun 22, 2008
    #2
    1. Advertising

  3. On Sun, Jun 22, 2008 at 09:15:46AM +0900, Joel VanderWerf wrote:
    > Jeremy Hinegardner wrote:
    >> Amalgalite embeds the SQLite database engine in a ruby extension.

    >
    > Is that really better than linking with libsqlite?


    That depends on what you mean by "better" :). If it is performane, I
    have no idea, as I haven't run any performance tests yet.

    For me, it is a few it is a few other reasons:

    1) Windows support, because sqlite is embedded in the extension, I can
    ship a Windows gem that doesn't require sqlite to be aleady
    installed. I haven't built the windows gem yet, that should be
    coming along in the next week or two.

    2) SQLite "Professional Support Options". There are a couple of options
    available from http://www.hwaci.com/sw/sqlite/prosupport.html that
    I would like to be able to support. Namely the Encrypted Database
    option. Having sqlite3.c embedded in the extension allows someone
    who purchases one of those options to just drop the source code into
    the gem and rebuild.

    3) Feature control. I'm utilizing compliation dependent API calls.
    Right now I'm utilizing the sqlite3_column_XXXX_name calls to get
    column meta data for a result set. These API calls are only exposed
    when SQLITE_ENABLE_COLUMN_METADATA=1 during compliation.

    Also, eventually I'm going to expose two SQLite extensions, full text
    search and R-trees. I'm sure everyone knows what full text search is
    for, and the R-tree extension allows for extremely fast spatial
    searching, i.e. latitude, longitude.

    Thoughts, comments anyone? Do those sound like things you might use?

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
     
    Jeremy Hinegardner, Jun 22, 2008
    #3
  4. Jeremy Hinegardner wrote:
    > Also, eventually I'm going to expose two SQLite extensions, full text
    > search and R-trees. I'm sure everyone knows what full text search is
    > for, and the R-tree extension allows for extremely fast spatial
    > searching, i.e. latitude, longitude.


    You mean like postgis, but in a sqlite sized package? That would be
    very, very cool. I didn't know sqlite even had such an extension.

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
     
    Joel VanderWerf, Jun 22, 2008
    #4
  5. On Sun, Jun 22, 2008 at 10:46:28AM +0900, Joel VanderWerf wrote:
    > Jeremy Hinegardner wrote:
    >> Also, eventually I'm going to expose two SQLite extensions, full text
    >> search and R-trees. I'm sure everyone knows what full text search is
    >> for, and the R-tree extension allows for extremely fast spatial
    >> searching, i.e. latitude, longitude.

    >
    > You mean like postgis, but in a sqlite sized package? That would be very,
    > very cool. I didn't know sqlite even had such an extension.


    Yup, its in the source tree but not part of the released version of
    SQLite yet.

    http://www.sqlite.org/cvstrac/dir?d=sqlite/ext/rtree

    I'm guessing it'll be in the next official release.

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
     
    Jeremy Hinegardner, Jun 22, 2008
    #5
  6. Jeremy Hinegardner

    Une Bévue Guest

    Jeremy Hinegardner <> wrote:

    > Amalgalite embeds the SQLite database engine in a ruby extension.
    >
    > * http://www.copiousfreetime.org/projects/amalgalite/
    > * http://copiousfreetime.org/articles/

    2008/06/21/amalgalite-0-1-0-released.html

    I've downloaded the gem, however install failed :
    ~/gems%> sudo gem install -l amalgalite
    Password:
    ERROR: Error installing amalgalite:
    amalgalite requires configuration (>= 0.0.5)

    if i try to install configuration, i get :
    ~/src/ruby/rubygems-1.2.0%> sudo gem install -r configuration
    Password:
    Bulk updating Gem source index for: http://gems.rubyforge.org/
    ERROR: could not find configuration locally or in a repository

    are u using the latest rubygems vesion ?

    i'm running MacOS X 10.4.11
    $> ruby --version
    ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0]
    $ gem env
    RubyGems Environment:
    - RUBYGEMS VERSION: 1.1.0 (1.1.0)
    - RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111)
    [powerpc-darwin8.11.0]
    - INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
    - RUBY EXECUTABLE: /opt/local/bin/ruby
    - RUBYGEMS PLATFORMS:
    - ruby
    - powerpc-darwin-8
    - GEM PATHS:
    - /opt/local/lib/ruby/gems/1.8
    - GEM CONFIGURATION:
    - :update_sources => true
    - :verbose => true
    - :benchmark => false
    - :backtrace => false
    - :bulk_threshold => 1000
    - REMOTE SOURCES:
    - http://gems.rubyforge.org

    --
    Une Bévue
     
    Une Bévue, Jun 24, 2008
    #6
  7. Jeremy Hinegardner

    ara.t.howard Guest

    On Jun 24, 2008, at 5:33 AM, Une B=E9vue wrote:

    > Jeremy Hinegardner <> wrote:
    >
    >> Amalgalite embeds the SQLite database engine in a ruby extension.
    >>
    >> * http://www.copiousfreetime.org/projects/amalgalite/
    >> * http://copiousfreetime.org/articles/

    > 2008/06/21/amalgalite-0-1-0-released.html
    >
    > I've downloaded the gem, however install failed :
    > ~/gems%> sudo gem install -l amalgalite
    > Password:
    > ERROR: Error installing amalgalite:
    > amalgalite requires configuration (>=3D 0.0.5)


    cfp:~ > sudo gem install configuration
    Bulk updating Gem source index for: http://gems.rubyforge.org
    Successfully installed configuration-0.0.5
    1 gem installed


    it's on http://codeforpeople.com or =
    http://rubyforge.org/projects/codeforpeople=20
    if you just want to grab the gem - no idea what's up with you gem =20
    command ;-(

    a @ http://codeforpeople.com/
    --
    we can deny everything, except that we have the possibility of being =20
    better. simply reflect on that.
    h.h. the 14th dalai lama
     
    ara.t.howard, Jun 24, 2008
    #7
  8. Jeremy Hinegardner

    Une Bévue Guest

    ara.t.howard <> wrote:

    > cfp:~ > sudo gem install configuration
    > Bulk updating Gem source index for: http://gems.rubyforge.org
    > Successfully installed configuration-0.0.5
    > 1 gem installed


    may be u aren't running Mac OS X 10.4.11 ??? :[

    i've heard, i don't remember where and when, rubygems has probs with
    remote install on mac os x 10.4.11.

    however, in the meantime i did install sproutcore (from Apple) without
    any prob...

    notice i'm still unable to upgrade rubygems to 1.2...
    >
    > it's on http://codeforpeople.com or
    > http://rubyforge.org/projects/codeforpeople
    > if you just want to grab the gem - no idea what's up with you gem
    > command ;-(
    >
    > a @ http://codeforpeople.com/


    right now i get trouble with mkrf )) :
    ~/gems%> sudo gem install -l configuration
    Password:
    Successfully installed configuration-0.0.5
    1 gem installed

    ~/gems%> sudo gem install -l amalgalite
    Building native extensions. This could take a while...
    ERROR: Error installing amalgalite:
    ERROR: Failed to build gem native extension.

    /opt/local/bin/ruby mkrf_conf.rb install -l amalgalite
    /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
    `gem_original_require': no such file to load -- mkrf (LoadError)
    from
    /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
    `require'
    from mkrf_conf.rb:2


    Gem files will remain installed in
    /opt/local/lib/ruby/gems/1.8/gems/amalgalite-0.1.0 for inspection.
    Results logged to
    /opt/local/lib/ruby/gems/1.8/gems/amalgalite-0.1.0/ext/gem_make.out
    ~/gems%>

    anyway, thanks, i got "configuration" !
    --
    Une Bévue
     
    Une Bévue, Jun 24, 2008
    #8
  9. Jeremy Hinegardner

    Une Bévue Guest

    Une Bévue <> wrote:

    just to say, finally i get it (ie. amalgalite), after mkrf update.

    --
    Une Bévue
     
    Une Bévue, Jun 24, 2008
    #9
  10. On Wed, Jun 25, 2008 at 03:08:02AM +0900, Une B?vue wrote:
    > Une B?vue <> wrote:
    >
    > just to say, finally i get it (ie. amalgalite), after mkrf update.


    That would be a bug on my part in amalgalite, thanks for fiding it.
    I forgot to put a gem dependency on mkrf. Its fixed in the repository.

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
     
    Jeremy Hinegardner, Jun 26, 2008
    #10
  11. Jeremy Hinegardner

    Une Bévue Guest

    Jeremy Hinegardner <> wrote:

    > That would be a bug on my part in amalgalite, thanks for fiding it.
    > I forgot to put a gem dependency on mkrf. Its fixed in the repository.


    fine !

    i did a first try reading a database created with PHP ;-)

    no prob.

    i've also listed the tables in this db using :
    db.execute( "SELECT name FROM sqlite_master WHERE type='table' ORDER BY
    name;" )

    no prob too.

    but, for the time being, i'm unable to find a way to list the columns
    name within a given table...

    are those info written into "sqlite_master" too ?
    --
    Une Bévue
     
    Une Bévue, Jun 26, 2008
    #11
  12. On Thu, Jun 26, 2008 at 03:22:52PM +0900, Une B?vue wrote:
    > Jeremy Hinegardner <> wrote:
    >
    > > That would be a bug on my part in amalgalite, thanks for fiding it.
    > > I forgot to put a gem dependency on mkrf. Its fixed in the repository.

    >
    > fine !
    >
    > i did a first try reading a database created with PHP ;-)
    >
    > no prob.
    >
    > i've also listed the tables in this db using :
    > db.execute( "SELECT name FROM sqlite_master WHERE type='table' ORDER BY
    > name;" )
    >
    > no prob too.
    >
    > but, for the time being, i'm unable to find a way to list the columns
    > name within a given table...
    >
    > are those info written into "sqlite_master" too ?


    The sqlite_master has information about tables and views, but no columnar
    information.

    With the sqlite3 command line you can get some column information by using the
    'pragma table_info( tbl_name )' command.

    Meta information is available from within Amalgalite itself try this out:

    db = Amalgalite::Database.new( db_name )
    col_info = %w[ default_value declared_data_type collation_sequence_name not_null_constraint primary_key auto_increment ]
    max_width = col_info.collect { |c| c.length }.sort.last

    db.schema.tables.keys.sort.each do |table_name|
    puts "Table: #{table_name}"
    puts "=" * 42
    db.schema.tables[table_name].columns.each_pair do |col_name, col|
    puts " Column : #{col.name}"
    col_info.each do |ci|
    puts " |#{ci.rjust( max_width, "." )} : #{col.send( ci )}"
    end
    puts
    end
    end

    Amalgalite uses the SQLITE_ENABLE_COLUMN_METADATA compilation option so more
    detailed metadata is available than in the default builds of sqlite.

    pragma table_info can give you,

    - name
    - type
    - whether the column has a not-null constraint or not
    - default value
    - whehter the column is a primary key or not.

    Using Amalgalite you may also find out:

    - the default collation sequence
    - whether or not the column is auto increment or not

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
     
    Jeremy Hinegardner, Jun 30, 2008
    #12
  13. Jeremy Hinegardner

    Une Bévue Guest

    Jeremy Hinegardner <> wrote:

    > The sqlite_master has information about tables and views, but no columnar
    > information.
    >
    > With the sqlite3 command line you can get some column information by using the
    > 'pragma table_info( tbl_name )' command.
    >

    [...]
    >
    > Using Amalgalite you may also find out:
    >
    > - the default collation sequence
    > - whether or not the column is auto increment or not


    fine, thanks !
    --
    Une Bévue
     
    Une Bévue, Jun 30, 2008
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Follower
    Replies:
    0
    Views:
    343
    Follower
    May 7, 2004
  2. Kirill Simonov

    [ANN] LibYAML-0.0.1: The initial release

    Kirill Simonov, Aug 1, 2006, in forum: Python
    Replies:
    0
    Views:
    359
    Kirill Simonov
    Aug 1, 2006
  3. Andrey Khavryuchenko
    Replies:
    0
    Views:
    638
    Andrey Khavryuchenko
    Jan 15, 2007
  4. Jim Menard

    [ANN] midilib initial release

    Jim Menard, Jun 27, 2004, in forum: Ruby
    Replies:
    2
    Views:
    141
    Jim Menard
    Jun 27, 2004
  5. Taku Nakajima

    [ANN] Amrita2 initial release

    Taku Nakajima, Feb 24, 2005, in forum: Ruby
    Replies:
    0
    Views:
    134
    Taku Nakajima
    Feb 24, 2005
Loading...

Share This Page