SlideShare a Scribd company logo
1 of 135
Download to read offline
Cassandra &
CassandraObject
      Michael Koziarski
   michael@koziarski.com
Intro to Me
I Don’t Have To Scale
Intro to Cassandra
Distributed
Fault Tolerant
Elastic
The Ring
    A




F       B




E       C




    D
The Ring
    A




F       B




E       C




    D
The Ring
    A




F       B




E       C




    D
The Ring
    A




F       B




E       C




    D
The Ring
    A




F       B




E       C




    D
The Ring
    A




F       B




E       C




    D
The Ring
    A




F       B




E       C




    D
The Ring
                    someKey

                    A




               F            B




               E            C




                    D




RandomPartitioner       OrderPreservingPartitioner
    MD5(key)                      key
Replication Factor
             someKey

            A




      F            B




      E            C




            D




          RF = 2
Replication Factor
             someKey

            A




      F            B




      E            C




            D




          RF = 3
Consistency Level
    GET
 'someKey'

                 A




             F       B




             E       C




                 D




       ConsistencyLevel.ONE
Consistency Level
    GET
 'someKey'

                 A




             F       B




             E       C




                 D




       ConsistencyLevel.ONE
Consistency Level
    GET
 'someKey'

                 A




             F       B




             E       C




                 D




       ConsistencyLevel.ONE
Consistency Level
    GET
 'someKey'

                 A




             F       B




             E       C




                 D




       ConsistencyLevel.ONE
Consistency Level
    GET
 'someKey'

                 A




             F       B




             E       C




                 D




 ConsistencyLevel.QUORUM
Consistency Level
    GET
 'someKey'

                 A




             F       B




             E       C




                 D




 ConsistencyLevel.QUORUM
Consistency Level
    GET
 'someKey'

                 A




             F       B




             E       C




                 D




 ConsistencyLevel.QUORUM
Consistency Level
    GET
 'someKey'

                  A




             F         B




             E         C




                  D




         ConsistencyLevel.ALL
Consistency Level
    GET
 'someKey'

                  A




             F         B




             E         C




                  D




         ConsistencyLevel.ALL
Consistency Level
    GET
 'someKey'

                  A




             F         B




             E         C




                  D




         ConsistencyLevel.ALL
Consistency Level
    GET
 'someKey'

                  A




             F         B




             E         C




                  D




         ConsistencyLevel.ALL
Fault Tolerance
   GET
'someKey'

                A




            F       DEAD




            E        C




                D




ConsistencyLevel.QUORUM
Fault Tolerance
   GET
'someKey'

                A




            F       DEAD




            E        C




                D




ConsistencyLevel.QUORUM
Fault Tolerance
   GET
'someKey'

                A




            F




            E       C




                D
Elastic
        NEW
    A




F        B




E        C




    D
Elastic
        NEW
    A




F        B




E        C




    D
Data Model
Key Value Store

                Some
someKey
                Value
Column Store
Column
Column

firstName   Michael
Row (Column Family)

            firstName   Michael
someKey
            lastName   Koziarski
Row (Super Column Family)
                            firstName   Michael
           someSubColumn
                            lastName   Koziarski
 someKey


                            firstName     Kate
           otherSubColumn
                            lastName   Koziarski
JSON
Column
{
    'name':  'first_name',
    'value':  'Michael',
    'timestamp':  1276040575
}
Column

{
    'first_name':  "Michael"
}
Column Family

Users["koz"]  =  {
    'first_name':  'Michael',
    'last_name':  'Koziarski'
}
Column Family

Users["koz"]  =  {
    'first_name':  'Michael',
    'last_name':  'Koziarski'
}
Column Family

Users["koz"]  =  {
    'first_name':  'Michael',
    'last_name':  'Koziarski'
}
Column Family

Users["koz"]  =  {
    'first_name':  'Michael',
    'last_name':  'Koziarski'
}
Super Column Family
  UserAddresses["koz"]  =  {
      "home"  :  {
          "suburb":  "Berhampore"
          "city":  "Wellington",
          "country":  "New  Zealand"
      },
      "office"  :  {
          "suburb":  "CBD"
          "city":  "Wellington",
          "country":  "New  Zealand"
      }
  }
Don’t let the name fool
          you
One to Many

Timeline["nzkoz"]  =  {
    uuid_one:      "http://twitter.com/chadfowler/status/15740739666",  
    uuid_two:      "http://twitter.com/dhh/status/15740689762",
    uuid_three:  "http://twitter.com/glv/status/15740546908"
}




  <ColumnFamily  CompareWith="TimeUUIDType"  Name="Timeline"/>
Modeling
Schema Driven
   Modeling
Start with your Data
Model

     User
firstName
lastName
dateOfBirth
Figure out the Queries
Query

SELECT  firstName,  lastName  
FROM      `users`
WHERE  dateOfBirth  <  '1992-­‐06-­‐09'
Query
SELECT  dateOfBirth
FROM      `users`
WHERE  firstName  =  'Michael'  
                AND
            lastName  =  'Koziarski'
Query

SELECT  firstName,  lastName  
FROM      `users`
WHERE  YEAR(dateOfBirth)  =  1980
Query

SELECT  COUNT(DISTINCT  firstName)
FROM  `users`
WHERE  dateOfBirth  <  '1992-­‐06-­‐09'
Cassandra Limitations
No WHERE
No WHERE
       Kinda
No ORDER
No ORDER
       Kinda
No COUNT
No COUNT
      Kinda
No SUM
Query Driven
 Modeling
Start with the Queries
Populate a data model
 which enables them
Modeling Example
Users

Users["koz"]  =  {
    'first_name':  "Michael",
    'last_name':  "Koziarski"
}
Users

Users["koz"]  =  {
    'first_name':  "Michael",
    'last_name':  "Koziarski"
}


 connection.get(:Users,  "koz")
Koziarski Family
UsersByLastName["koziarski"]  =  {
    uuid_one:  "koz"
    uuid_two:  "kate"
}
Koziarski Family
            UsersByLastName["koziarski"]  =  {
                uuid_one:  "koz"
                uuid_two:  "kate"
            }


connection.get(:UsersByLastName,  "koziarski").values.map  do  |key|
    connection.get(:Users,  key)
end
Share my Birthday
UsersByDOB["1980-­‐08-­‐15"]  =  {
    uuid_one:  "koz"
}
Share my Birthday
   UsersByDOB["1980-­‐08-­‐15"]  =  {
       uuid_one:  "koz"
   }




connection.get(:UsersByDOB,  "1980-­‐08-­‐15")
Users Born in 1980
 UsersByDOB["1980-­‐08-­‐15"]  =  {
     uuid_one:  "koz"
 }
Users Born in 1980
              UsersByDOB["1980-­‐08-­‐15"]  =  {
                  uuid_one:  "koz"
              }



connection.get_range(:UsersByDOB,  :start=>"1980",  :finish=>"1981")
Users Born in 1980
              UsersByDOB["1980-­‐08-­‐15"]  =  {
                  uuid_one:  "koz"
              }



connection.get_range(:UsersByDOB,  :start=>"1980",  :finish=>"1981")



                       Only with OrderPreservingPartitioner
A Column Family per
      Query
Do you really need
    Cassandra?
CassandraObject
class  Customer  <  CassandraObject::Base
    attribute  :first_name,        :type  =>  :string
    attribute  :last_name,          :type  =>  :string
    attribute  :date_of_birth,  :type  =>  :date
    attribute  :signed_up_at,    :type  =>  :time_with_zone

    validate  :should_be_cool

    key  :uuid

    index  :date_of_birth

    association  :invoices,  :unique=>false,  :inverse_of=>:customer

    private

    def  should_be_cool
        unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)
            errors.add(:first_name,  "must  be  that  of  a  cool  person")
        end
    end
end
Motivations
Prove ActiveModel
Learn Cassandra
Have a fun Side Project
Solve my Scaling
   Problems
Solve my Scaling
   Problems
Mostly AR Compatible
Not Compatible

def  index
    @people  =  @customer.people.order(params[:order]).
                                                          limit(params[:limit]).
                                                          where(...)
end
Compatible
def  create
    @person  =  Customer.new  params[:customer]
    if  @person.save
        redirect_to  @person
    else
        render  :action=>'new'
    end
end
Compatible

<%=  form_for(@customer)  do  |customer|  %>
    <%=  customer.error_messages  %>
    <%=  customer.text_field  :first_name  %>
    <%=  customer.submit  "Save"  %>
<%  end  %>
Walkthrough
class  Customer  <  CassandraObject::Base
    attribute  :first_name,        :type  =>  :string
    attribute  :last_name,          :type  =>  :string
    attribute  :date_of_birth,  :type  =>  :date
    attribute  :signed_up_at,    :type  =>  :time_with_zone

    validate  :should_be_cool

    key  :uuid

    index  :date_of_birth

    association  :invoices,  :unique=>false,  :inverse_of=>:customer

    private

    def  should_be_cool
        unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)
            errors.add(:first_name,  "must  be  that  of  a  cool  person")
        end
    end
end
class  Invoice  <  CassandraObject::Base
    attribute  :number,  :type=>:integer
    attribute  :total,  :type=>:float
    attribute  :gst_number,  :type=>:string

    #  indexes  can  have  a  single  entry  also.
    index  :number,  :unique=>true

    #  bi-­‐directional  associations  with  read-­‐repair  support.
    association  :customer,  :unique=>true,  :inverse_of=>:invoices

    #  Read  migration  support
    migrate  1  do  |attrs|
        attrs["total"]  ||=  rand(2000)  /  100.0
    end

    migrate  2  do  |attrs|
        attrs["gst_number"]  =  "66-­‐666-­‐666"
    end

    key  :natural,  :attributes  =>  :number
end
Attributes
attribute  :first_name,        :type  =>  :string
attribute  :last_name,          :type  =>  :string
attribute  :date_of_birth,  :type  =>  :date
attribute  :signed_up_at,    :type  =>  :time_with_zone
attribute  :number,                :type  =>  :integer
attribute  :total,                  :type  =>  :float
attribute  :gst_number,        :type  =>  :string
Attributes
  attribute  :first_name,  :type  =>  :string



@customer.first_name  =  "Michael"
@customer.attributes=  {:first_name=>"Michael"}
Validations
                    validate  :should_be_cool



def  should_be_cool
    unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)
        errors.add(:first_name,  "must  be  that  of  a  cool  person")
    end
end
Validations
                    validate  :should_be_cool



def  should_be_cool
    unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)
        errors.add(:first_name,  "must  be  that  of  a  cool  person")
    end
end



             @customer.first_name  =  "Marcel"
             @customer.valid?  #  =>  false
Validations

validates_confirmation_of  :tos
validates_format_of  :gst_number,  :with=>  /.../
validates_length_of  :first_name,  :max=>123
Keys
Key Selection Matters
Key Selection Matters
              UsersByDOB["1980-­‐08-­‐15"]  =  {
                  uuid_one:  "koz"
              }



connection.get_range(:UsersByDOB,  :start=>"1980",  :finish=>"1981")
Keys

key  :uuid
Keys

              key  :uuid

"bf1ba5da-­‐735a-­‐11df-­‐8b47-­‐377649cf993b"
Keys

key  :natural,  :attributes  =>  :number
Custom Key Factories

key  RedisKeyFactory.new(REDIS_CONNECTION,  "customer_key")
Custom Key Factories
class  RedisKeyFactory
    def  initialize(connection,  key)
        @connection,  @key  =  connection,  key
    end
    
    def  next_key(object)
        @connection.incr(@key)
    end
    
    #  Parse  should  create  a  new  key  object  from  the  'to_param'  format
    def  parse(string)
        string.to_i
    end
    
    #  create  should  create  a  new  key  object  from  the  cassandra  format.
    def  create(string)
        string.to_i
    end    
end
Migrations
Migrations
class  AddLicenseNameToArticle  <  ActiveRecord::Migration
    def  self.up
        add_column  :articles,  :license_name,  :string,  :default=>"Exclusive"

        execute  "UPDATE  articles  SET  license_name  =  'Exclusive'    
                            WHERE  price_first  IS  NOT  NULL"
        execute  "UPDATE  articles  SET  license_name  =  'Syndicated'
                            WHERE  price_first  IS  NULL"
    end

    def  self.down
        remove_column  :articles,  :license_name
    end
end
Migrations

{
    'price_first':  45,
    'schema_version':  0
}
Migrations
class  Article  <  CassandraObject::Base
    attribute  :price_first,  :type=>:float
    attribute  :license_name,  :type=>:string

    migrate  1  do  |attrs|
        if  attrs[:price_first]
            attrs[:license_name]  =  "Exclusive"
        else
            attrs[:license_name]  =  "Syndicated"
        end
    end
end
Migrations
class  Article  <  CassandraObject::Base
    attribute  :price_first,  :type=>:float
    attribute  :license_name,  :type=>:string

    migrate  1  do  |attrs|
        if  attrs[:price_first]
            attrs[:license_name]  =  "Exclusive"
        else
            attrs[:license_name]  =  "Syndicated"
        end
    end
end

  @article  =  Article.get("some-­‐old-­‐story")
  @article.license_name  #  =>  "Exclusive"
Migrations

{
    'price_first':  45,
    'schema_version':  1,
    'license_name':  'Exclusive'
}
Indexes
Indexes
           class  Article  <  CassandraObject::Base
               attribute  :slug,  :type=>:string
               key  :uuid
               index  :slug,  :unique=>true
           end


connection.insert(:ArticlesBySlug,  @article.slug,  
                                    {UUID.new  =>  @article.key})
Indexes
           class  Article  <  CassandraObject::Base
               attribute  :slug,  :type=>:string
               key  :uuid
               index  :slug,  :unique=>true
           end


connection.insert(:ArticlesBySlug,  @article.slug,  
                                    {UUID.new  =>  @article.key})

   @article  =  Article.find_by_slug("some-­‐slug")
Indexes
    class  Article  <  CassandraObject::Base
        attribute  :publication_date,  :type=>:date
        key  :uuid
        index  :publication_date,  :unique=>false
    end

connection.insert(:ArticlesByPublicationDate,  
                                    @article.publication_date,  
                                  {UUID.new  =>  @article.key})
Indexes
    class  Article  <  CassandraObject::Base
        attribute  :publication_date,  :type=>:date
        key  :uuid
        index  :publication_date,  :unique=>false
    end

connection.insert(:ArticlesByPublicationDate,  
                                    @article.publication_date,  
                                  {UUID.new  =>  @article.key})

    @article  =  Article.find_all_by_publication_date(Date.today  -­‐  1)
Indexes
    class  Article  <  CassandraObject::Base
        attribute  :publication_date,  :type=>:date
        key  :uuid
        index  :publication_date,  :unique=>false
    end

connection.insert(:ArticlesByPublicationDate,  
                                    @article.publication_date,  
                                  {UUID.new  =>  @article.key})

    @article  =  Article.find_all_by_publication_date(Date.today  -­‐  1)
Read-Repair
results  =  []
connection.get(:ArticlesByPublicationDate,  date).each  do  |(uuid,  key)|
    article  =  Article.get(uuid)
    if  article.publication_date  !=  date
        connection.delete(:ArticlesByPublicationDate,  date,  uuid)
    else
        results  <<  article
    end
end
results
Associations
Associations
class  Invoice  <  CassandraObject::Base
    association  :customer,  :unique=>true,  :inverse_of=>:invoices
end

class  Customer  <  CassandraObject::Base
    association  :invoices,  :unique=>false,  :inverse_of=>:customer
end


   @customer.invoices.create!  params[:invoice]


                   @invoice.customer
Project Status
Very Beta
In Flux
Taking Patches
Thanks!
            Michael Koziarski
         michael@koziarski.com


http://github.com/NZKoz/cassandra_object
http://cassandra.apache.org/

More Related Content

Recently uploaded

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Recently uploaded (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Intro to Cassandra and CassandraObject

  • 1. Cassandra & CassandraObject Michael Koziarski michael@koziarski.com
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. I Don’t Have To Scale
  • 9.
  • 13. The Ring A F B E C D
  • 14. The Ring A F B E C D
  • 15. The Ring A F B E C D
  • 16. The Ring A F B E C D
  • 17. The Ring A F B E C D
  • 18. The Ring A F B E C D
  • 19. The Ring A F B E C D
  • 20. The Ring someKey A F B E C D RandomPartitioner OrderPreservingPartitioner MD5(key) key
  • 21. Replication Factor someKey A F B E C D RF = 2
  • 22. Replication Factor someKey A F B E C D RF = 3
  • 23. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ONE
  • 24. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ONE
  • 25. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ONE
  • 26. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ONE
  • 27. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.QUORUM
  • 28. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.QUORUM
  • 29. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.QUORUM
  • 30. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ALL
  • 31. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ALL
  • 32. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ALL
  • 33. Consistency Level GET 'someKey' A F B E C D ConsistencyLevel.ALL
  • 34. Fault Tolerance GET 'someKey' A F DEAD E C D ConsistencyLevel.QUORUM
  • 35. Fault Tolerance GET 'someKey' A F DEAD E C D ConsistencyLevel.QUORUM
  • 36. Fault Tolerance GET 'someKey' A F E C D
  • 37. Elastic NEW A F B E C D
  • 38. Elastic NEW A F B E C D
  • 40. Key Value Store Some someKey Value
  • 43. Column firstName Michael
  • 44. Row (Column Family) firstName Michael someKey lastName Koziarski
  • 45. Row (Super Column Family) firstName Michael someSubColumn lastName Koziarski someKey firstName Kate otherSubColumn lastName Koziarski
  • 46. JSON
  • 47. Column {    'name':  'first_name',    'value':  'Michael',    'timestamp':  1276040575 }
  • 49. Column Family Users["koz"]  =  {    'first_name':  'Michael',    'last_name':  'Koziarski' }
  • 50. Column Family Users["koz"]  =  {    'first_name':  'Michael',    'last_name':  'Koziarski' }
  • 51. Column Family Users["koz"]  =  {    'first_name':  'Michael',    'last_name':  'Koziarski' }
  • 52. Column Family Users["koz"]  =  {    'first_name':  'Michael',    'last_name':  'Koziarski' }
  • 53. Super Column Family UserAddresses["koz"]  =  {    "home"  :  {        "suburb":  "Berhampore"        "city":  "Wellington",        "country":  "New  Zealand"    },    "office"  :  {        "suburb":  "CBD"        "city":  "Wellington",        "country":  "New  Zealand"    } }
  • 54. Don’t let the name fool you
  • 55. One to Many Timeline["nzkoz"]  =  {    uuid_one:      "http://twitter.com/chadfowler/status/15740739666",      uuid_two:      "http://twitter.com/dhh/status/15740689762",    uuid_three:  "http://twitter.com/glv/status/15740546908" } <ColumnFamily  CompareWith="TimeUUIDType"  Name="Timeline"/>
  • 57. Schema Driven Modeling
  • 59. Model User firstName lastName dateOfBirth
  • 60. Figure out the Queries
  • 61. Query SELECT  firstName,  lastName   FROM      `users` WHERE  dateOfBirth  <  '1992-­‐06-­‐09'
  • 62. Query SELECT  dateOfBirth FROM      `users` WHERE  firstName  =  'Michael'                  AND            lastName  =  'Koziarski'
  • 63. Query SELECT  firstName,  lastName   FROM      `users` WHERE  YEAR(dateOfBirth)  =  1980
  • 64. Query SELECT  COUNT(DISTINCT  firstName) FROM  `users` WHERE  dateOfBirth  <  '1992-­‐06-­‐09'
  • 67. No WHERE Kinda
  • 69. No ORDER Kinda
  • 71. No COUNT Kinda
  • 74. Start with the Queries
  • 75. Populate a data model which enables them
  • 77. Users Users["koz"]  =  {    'first_name':  "Michael",    'last_name':  "Koziarski" }
  • 78. Users Users["koz"]  =  {    'first_name':  "Michael",    'last_name':  "Koziarski" } connection.get(:Users,  "koz")
  • 79. Koziarski Family UsersByLastName["koziarski"]  =  {    uuid_one:  "koz"    uuid_two:  "kate" }
  • 80. Koziarski Family UsersByLastName["koziarski"]  =  {    uuid_one:  "koz"    uuid_two:  "kate" } connection.get(:UsersByLastName,  "koziarski").values.map  do  |key|    connection.get(:Users,  key) end
  • 81. Share my Birthday UsersByDOB["1980-­‐08-­‐15"]  =  {    uuid_one:  "koz" }
  • 82. Share my Birthday UsersByDOB["1980-­‐08-­‐15"]  =  {    uuid_one:  "koz" } connection.get(:UsersByDOB,  "1980-­‐08-­‐15")
  • 83. Users Born in 1980 UsersByDOB["1980-­‐08-­‐15"]  =  {    uuid_one:  "koz" }
  • 84. Users Born in 1980 UsersByDOB["1980-­‐08-­‐15"]  =  {    uuid_one:  "koz" } connection.get_range(:UsersByDOB,  :start=>"1980",  :finish=>"1981")
  • 85. Users Born in 1980 UsersByDOB["1980-­‐08-­‐15"]  =  {    uuid_one:  "koz" } connection.get_range(:UsersByDOB,  :start=>"1980",  :finish=>"1981") Only with OrderPreservingPartitioner
  • 86. A Column Family per Query
  • 87. Do you really need Cassandra?
  • 89. class  Customer  <  CassandraObject::Base    attribute  :first_name,        :type  =>  :string    attribute  :last_name,          :type  =>  :string    attribute  :date_of_birth,  :type  =>  :date    attribute  :signed_up_at,    :type  =>  :time_with_zone    validate  :should_be_cool    key  :uuid    index  :date_of_birth    association  :invoices,  :unique=>false,  :inverse_of=>:customer    private    def  should_be_cool        unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)            errors.add(:first_name,  "must  be  that  of  a  cool  person")        end    end end
  • 93. Have a fun Side Project
  • 94. Solve my Scaling Problems
  • 95. Solve my Scaling Problems
  • 97. Not Compatible def  index    @people  =  @customer.people.order(params[:order]).                                                          limit(params[:limit]).                                                          where(...) end
  • 98. Compatible def  create    @person  =  Customer.new  params[:customer]    if  @person.save        redirect_to  @person    else        render  :action=>'new'    end end
  • 99. Compatible <%=  form_for(@customer)  do  |customer|  %>    <%=  customer.error_messages  %>    <%=  customer.text_field  :first_name  %>    <%=  customer.submit  "Save"  %> <%  end  %>
  • 101. class  Customer  <  CassandraObject::Base    attribute  :first_name,        :type  =>  :string    attribute  :last_name,          :type  =>  :string    attribute  :date_of_birth,  :type  =>  :date    attribute  :signed_up_at,    :type  =>  :time_with_zone    validate  :should_be_cool    key  :uuid    index  :date_of_birth    association  :invoices,  :unique=>false,  :inverse_of=>:customer    private    def  should_be_cool        unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)            errors.add(:first_name,  "must  be  that  of  a  cool  person")        end    end end
  • 102. class  Invoice  <  CassandraObject::Base    attribute  :number,  :type=>:integer    attribute  :total,  :type=>:float    attribute  :gst_number,  :type=>:string    #  indexes  can  have  a  single  entry  also.    index  :number,  :unique=>true    #  bi-­‐directional  associations  with  read-­‐repair  support.    association  :customer,  :unique=>true,  :inverse_of=>:invoices    #  Read  migration  support    migrate  1  do  |attrs|        attrs["total"]  ||=  rand(2000)  /  100.0    end    migrate  2  do  |attrs|        attrs["gst_number"]  =  "66-­‐666-­‐666"    end    key  :natural,  :attributes  =>  :number end
  • 103. Attributes attribute  :first_name,        :type  =>  :string attribute  :last_name,          :type  =>  :string attribute  :date_of_birth,  :type  =>  :date attribute  :signed_up_at,    :type  =>  :time_with_zone attribute  :number,                :type  =>  :integer attribute  :total,                  :type  =>  :float attribute  :gst_number,        :type  =>  :string
  • 104. Attributes attribute  :first_name,  :type  =>  :string @customer.first_name  =  "Michael" @customer.attributes=  {:first_name=>"Michael"}
  • 105. Validations validate  :should_be_cool def  should_be_cool    unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)        errors.add(:first_name,  "must  be  that  of  a  cool  person")    end end
  • 106. Validations validate  :should_be_cool def  should_be_cool    unless  ["Michael",  "Anika",  "Evan",  "James"].include?(first_name)        errors.add(:first_name,  "must  be  that  of  a  cool  person")    end end @customer.first_name  =  "Marcel" @customer.valid?  #  =>  false
  • 107. Validations validates_confirmation_of  :tos validates_format_of  :gst_number,  :with=>  /.../ validates_length_of  :first_name,  :max=>123
  • 108. Keys
  • 110. Key Selection Matters UsersByDOB["1980-­‐08-­‐15"]  =  {    uuid_one:  "koz" } connection.get_range(:UsersByDOB,  :start=>"1980",  :finish=>"1981")
  • 112. Keys key  :uuid "bf1ba5da-­‐735a-­‐11df-­‐8b47-­‐377649cf993b"
  • 114. Custom Key Factories key  RedisKeyFactory.new(REDIS_CONNECTION,  "customer_key")
  • 115. Custom Key Factories class  RedisKeyFactory    def  initialize(connection,  key)        @connection,  @key  =  connection,  key    end        def  next_key(object)        @connection.incr(@key)    end        #  Parse  should  create  a  new  key  object  from  the  'to_param'  format    def  parse(string)        string.to_i    end        #  create  should  create  a  new  key  object  from  the  cassandra  format.    def  create(string)        string.to_i    end     end
  • 117. Migrations class  AddLicenseNameToArticle  <  ActiveRecord::Migration    def  self.up        add_column  :articles,  :license_name,  :string,  :default=>"Exclusive"        execute  "UPDATE  articles  SET  license_name  =  'Exclusive'                                WHERE  price_first  IS  NOT  NULL"        execute  "UPDATE  articles  SET  license_name  =  'Syndicated'                            WHERE  price_first  IS  NULL"    end    def  self.down        remove_column  :articles,  :license_name    end end
  • 118. Migrations {    'price_first':  45,    'schema_version':  0 }
  • 119. Migrations class  Article  <  CassandraObject::Base    attribute  :price_first,  :type=>:float    attribute  :license_name,  :type=>:string    migrate  1  do  |attrs|        if  attrs[:price_first]            attrs[:license_name]  =  "Exclusive"        else            attrs[:license_name]  =  "Syndicated"        end    end end
  • 120. Migrations class  Article  <  CassandraObject::Base    attribute  :price_first,  :type=>:float    attribute  :license_name,  :type=>:string    migrate  1  do  |attrs|        if  attrs[:price_first]            attrs[:license_name]  =  "Exclusive"        else            attrs[:license_name]  =  "Syndicated"        end    end end @article  =  Article.get("some-­‐old-­‐story") @article.license_name  #  =>  "Exclusive"
  • 121. Migrations {    'price_first':  45,    'schema_version':  1,    'license_name':  'Exclusive' }
  • 123. Indexes class  Article  <  CassandraObject::Base    attribute  :slug,  :type=>:string    key  :uuid    index  :slug,  :unique=>true end connection.insert(:ArticlesBySlug,  @article.slug,                                      {UUID.new  =>  @article.key})
  • 124. Indexes class  Article  <  CassandraObject::Base    attribute  :slug,  :type=>:string    key  :uuid    index  :slug,  :unique=>true end connection.insert(:ArticlesBySlug,  @article.slug,                                      {UUID.new  =>  @article.key}) @article  =  Article.find_by_slug("some-­‐slug")
  • 125. Indexes class  Article  <  CassandraObject::Base    attribute  :publication_date,  :type=>:date    key  :uuid    index  :publication_date,  :unique=>false end connection.insert(:ArticlesByPublicationDate,                                      @article.publication_date,      {UUID.new  =>  @article.key})
  • 126. Indexes class  Article  <  CassandraObject::Base    attribute  :publication_date,  :type=>:date    key  :uuid    index  :publication_date,  :unique=>false end connection.insert(:ArticlesByPublicationDate,                                      @article.publication_date,      {UUID.new  =>  @article.key}) @article  =  Article.find_all_by_publication_date(Date.today  -­‐  1)
  • 127. Indexes class  Article  <  CassandraObject::Base    attribute  :publication_date,  :type=>:date    key  :uuid    index  :publication_date,  :unique=>false end connection.insert(:ArticlesByPublicationDate,                                      @article.publication_date,      {UUID.new  =>  @article.key}) @article  =  Article.find_all_by_publication_date(Date.today  -­‐  1)
  • 128. Read-Repair results  =  [] connection.get(:ArticlesByPublicationDate,  date).each  do  |(uuid,  key)|    article  =  Article.get(uuid)    if  article.publication_date  !=  date        connection.delete(:ArticlesByPublicationDate,  date,  uuid)    else        results  <<  article    end end results
  • 130. Associations class  Invoice  <  CassandraObject::Base    association  :customer,  :unique=>true,  :inverse_of=>:invoices end class  Customer  <  CassandraObject::Base    association  :invoices,  :unique=>false,  :inverse_of=>:customer end @customer.invoices.create!  params[:invoice] @invoice.customer
  • 135. Thanks! Michael Koziarski michael@koziarski.com http://github.com/NZKoz/cassandra_object http://cassandra.apache.org/