# sqlalchemy Package

## `sqlalchemy` Package

## `compiler` Module

class `crate.client.sqlalchemy.compiler.``CrateCompiler`(dialect, statement, column_keys=None, inline=False, **kwargs)

  Bases: `sqlalchemy.sql.compiler.SQLCompiler`

  `visit_getitem_binary`(binary, operator, **kw)
  `visit_update`(update_stmt, **kw)

    used to compile <sql.expression.Update> expressions

    only implements a subset of the SQLCompiler.visit_update method e.g. updating multiple tables is not supported.

`crate.client.sqlalchemy.compiler.``crate_before_execute`(conn, clauseelement, multiparams, params)

`crate.client.sqlalchemy.compiler.``rewrite_update`(clauseelement, multiparams, params)

  change the params to enable partial updates

  sqlalchemy by default only supports updates of complex types in the form of

  > “col = ?”, ({“x”: 1, “y”: 2}

  but crate supports

  > “col[‘x’] = ?, col[‘y’] = ?”, (1, 2)

## `dialect` Module

class `crate.client.sqlalchemy.dialect.``CrateDialect`(*args, **kwargs)

  Bases: `sqlalchemy.engine.default.DefaultDialect`

  `colspecs` = {<class 'sqlalchemy.types.Date'>: <class 'crate.client.sqlalchemy.dialect.Date'>, <class 'sqlalchemy.types.DateTime'>: <class 'crate.client.sqlalchemy.dialect.DateTime'>}
  `connect`(host=None, port=None, *args, **kwargs)
  classmethod `dbapi`()
  `do_rollback`(connection)
  `initialize`(connection)
  `name` = 'crate'
  `statement_compiler`

    alias of `CrateCompiler`

class `crate.client.sqlalchemy.dialect.``Date`(*args, **kwargs)

  Bases: `sqlalchemy.types.Date`

  `bind_processor`(dialect)
  `result_processor`(dialect, coltype)

class `crate.client.sqlalchemy.dialect.``DateTime`(timezone=False)

  Bases: `sqlalchemy.types.DateTime`

  `bind_processor`(dialect)
  `result_processor`(dialect, coltype)

## `test` Module

class `crate.client.sqlalchemy.test.``SqlAlchemyConnectionTest`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  `setUp`()
  `test_connection_multiple_server`()
  `test_connection_server`()
  `test_default_connection`()

class `crate.client.sqlalchemy.test.``SqlAlchemyDictTypeTest`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  `assertSQL`(expected_str, actual_expr)
  `setUp`()
  `setUpCharacter`()
  `setUp_fake_cursor`()
  `test_change_tracking`(*args, **keywargs)
  `test_partial_dict_update`(*args, **keywargs)
  `test_partial_dict_update_only_one_key_changed`(*args, **keywargs)

    if only one attribute of Craty is changed the update should only update that attribute not all attributes of Craty

  `test_partial_dict_update_with_delitem`(*args, **keywargs)
  `test_partial_dict_update_with_delitem_setitem`(*args, **keywargs)

    test that the change tracking doesn’t get messed up

    delitem -> setitem

  `test_partial_dict_update_with_regular_column`(*args, **keywargs)
  `test_partial_dict_update_with_setitem_delitem`(*args, **keywargs)

    test that the change tracking doesn’t get messed up

    setitem -> delitem

  `test_partial_dict_update_with_setitem_delitem_setitem`(*args, **keywargs)

    test that the change tracking doesn’t get messed up

    setitem -> delitem -> setitem

  `test_select_with_dict_column`()
  `test_select_with_dict_column_nested_where`()
  `test_select_with_dict_column_where_clause`()
  `test_select_with_dict_column_where_clause_gt`()
  `test_select_with_dict_column_where_clause_other_col`()
  `test_update_with_dict_column`()

## `types` Module

class `crate.client.sqlalchemy.types.``MutableDict`(initval=None)

  Bases: `sqlalchemy.ext.mutable.Mutable`, `dict`

  classmethod `coerce`(key, value)

    Convert plain dictionaries to MutableDict.