docs: def queries(table):
      """Given dictionaries of tables and view-queries, return a dictionary
      of all the rest of the queries I need.
  
      """
      def update_where(updcols, wherecols):
          """Return an ``UPDATE`` statement that updates the columns ``updcols``
          when the ``wherecols`` match. Every column has a bound parameter of
          the same name.
  
          updcols are strings, wherecols are column objects
  
          """
          vmap = OrderedDict()
          for col in updcols:
              vmap[col] = bindparam(col)
          wheres = [
              c == bindparam(c.name) for c in wherecols
          ]
          tab = wherecols[0].table
          return tab.update().values(**vmap).where(and_(*wheres))
  
      r = allegedb.alchemy.queries_for_table_dict(table)
  
      rulebooks = table['rulebooks']
      r['rulebooks_update'] = update_where(['rules'], [rulebooks.c.rulebook, rulebooks.c.branch, rulebooks.c.turn, rulebooks.c.tick])
  
      for t in table.values():
          key = list(t.primary_key)
          if 'branch' in t.columns and 'turn' in t.columns and 'tick' in t.columns:
              branch = t.columns['branch']
              turn = t.columns['turn']
              tick = t.columns['tick']
              if branch in key and turn in key and tick in key:
                  key = [branch, turn, tick]
          r[t.name + '_dump'] = select(list(t.c.values())).order_by(*key)
          r[t.name + '_insert'] = t.insert().values(tuple(bindparam(cname) for cname in t.c.keys()))
          r[t.name + '_count'] = select([func.COUNT('*')]).select_from(t)
  
      r['del_char_things'] = table['things'].delete().where(
          table['things'].c.character == bindparam('character')
      )
  
      r['del_char_avatars'] = table['avatars'].delete().where(
          table['avatars'].c.character_graph == bindparam('character')
      )
      things = table['things']
      r['del_things_after'] = things.delete().where(and_(
          things.c.character == bindparam('character'),
          things.c.thing == bindparam('thing'),
          things.c.branch == bindparam('branch'),
          or_(
              things.c.turn > bindparam('turn'),
              and_(
                  things.c.turn == bindparam('turn'),
                  things.c.tick >= bindparam('tick')
              )
          )
      ))
      avatars = table['avatars']
      r['del_avatars_after'] = avatars.delete().where(and_(
          avatars.c.character_graph == bindparam('character'),
          avatars.c.avatar_graph == bindparam('graph'),
          avatars.c.avatar_node == bindparam('avatar'),
          avatars.c.branch == bindparam('branch'),
          or_(
              avatars.c.turn > bindparam('turn'),
              and_(
                  avatars.c.turn == bindparam('turn'),
                  avatars.c.tick >= bindparam('tick')
              )
          )
      ))
  
      branches = table['branches']
  
      r['branch_children'] = select(
          [branches.c.branch]
      ).where(
          branches.c.parent == bindparam('branch')
      )
  
      tc = table['turns_completed']
      r['turns_completed_update'] = update_where(['turn'], [tc.c.branch])
  
      return r