title: SqlAlchemy: Applying a split in filter()
body: <ol>
  <li><p>I have a Checkout table where I stored "cart items" in a "cartIds" column, and the value is separated by comma. Ex) checkout.cartId &lt;56, 54></p></li>
  <li><p>To use this data on Python I need to split it first, and make it an array to apply it in the filter, which doesn't work as I expected. See the following for the better understanding.</p></li>
  </ol>
  
  <pre><code>db.query(checkout, cart).filter(checkout.userId == userId, cart.id.in_(checkout.CartId.split(','))).all()
  </code></pre>
  
  <ol start="3">
  <li>I solved it by using 'contains' in the filter, but if the database gets large, I am sure it will cause an error as it catches multiple values ex) '64' will catch 640, 641, 642.. so on. </li>
  </ol>
  
  <p>Is there any way to get the data as I want? I've looked up several articles, but couldn't find an answer. Basically I want to retrieve the data as follows:</p>
  
  <pre><code>
  checkout = {
  
    "id" : 1,
     ....
     "carts": [
        {'id': 1, 'price': 12, 'title': 'iPad'},
        {'id': 2, 'price': 11, 'title': 'iPhone'}
     ]
  
  
  }
  
  </code></pre>