lib/active_record/connection_adapters/bigquery_adapter.rb
# Creates a record with values matching those of the instance attributes
# and returns its id.
Creates a record with values matching those of the instance attributes
and returns its id.
Creates a record with values matching those of the instance attributes and returns its id .
def create_record(attribute_names = @attributes.keys)
      record_timestamps_hardcoded
      attributes_values = self.changes.values.map(&:last)
      row_hash = Hash[ [ self.changes.keys, attributes_values ].transpose ]
      new_id =  SecureRandom.hex
      @rows =   {"rows"=> [{
                            "insertId"=> Time.now.to_i.to_s,
                            "json"=> row_hash.merge("id"=> new_id)
                          }]
                }
      conn_cfg = self.class.connection_config
      result = BigBroda::TableData.create(conn_cfg[:project],
        conn_cfg[:database],
        self.class.table_name ,
        @rows )
      self.id = new_id 
      @new_record = false
      id
    end
def create_record ( attribute_names = @attributes . keys ) record_timestamps_hardcoded attributes_values = self . changes . values . map ( & :last ) row_hash = Hash [ [ self . changes . keys , attributes_values ] . transpose ] new_id = SecureRandom . hex @rows = { "rows" => [ { "insertId" => Time . now . to_i . to_s , "json" => row_hash . merge ( "id" => new_id ) } ] } conn_cfg = self . class . connection_config result = BigBroda :: TableData . create ( conn_cfg [ :project ] , conn_cfg [ :database ] , self . class . table_name , @rows ) self . id = new_id @new_record = false id end
Creates a record with values matching those of the instance attributes
and returns its id.
Creates a record with values matching those of the instance attributes and returns its id .
#raise result["error"]["errors"].map{|o| "[#{o['domain']}]: #{o['reason']} #{o['message']}" }.join(", ") if result["error"].present? #here we output the IN MEMORY id , because of the BQ latency #||= new_id if self.class.primary_key
attribute_names
<not_specific>
keys
<not_specific>