Sha256: 5fb47893492510673d324fff860367cc94a74b2749638b7728935be0b1593b48

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 Bytes

Contents

require 'helper'

class EnrichmentDb::Datum < EnrichmentDb::DatumModel
  def self.by_id(schema_name, table_name, condition)
    puts "Finding object from #{table_name} with condition #{condition}."
    query = "SELECT * FROM #{schema_name}.#{table_name} where #{condition}"
    
    result = EnrichmentDb.request(schema_name, query)
    
    if result.ntuples > 0 
      puts "Found #{result.ntuples} object/s"
      result.collect do |v|
        v
      end
    else 
      puts "Nothing found"
      nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enrichment_db-0.1.5 lib/enrichment_db/datum.rb