ploomber.clients.SQLAlchemyClient

class ploomber.clients.SQLAlchemyClient(uri, split_source='default', create_engine_kwargs=None)

Client for connecting with any SQLAlchemy supported database

Parameters
  • uri (str) – URI to pass to sqlalchemy.create_engine

  • split_source (str, optional) – Some database drivers do not support multiple commands in a single execute statement. Use this optiion to split commands by a given character (e.g. ‘;’) and send them one at a time. Defaults to ‘default’, which splits by ‘;’ if using SQLite database, but does not perform any splitting with other databases. If None, it will never split, a string value is interpreted as the token to use for splitting statements regardless of the database type

  • create_engine_kwargs (dict, optional) – Keyword arguments to pass to sqlalchemy.create_engine

Notes

SQLite client does not support sending more than one command at a time, if using such backend code will be split and several calls to the db will be performed.

Methods

close()

Closes all connections

cursor()

execute(code)

Execute code

close()

Closes all connections

cursor()
execute(code)

Execute code

Attributes

connection

Return a connection from the pool

engine

Returns a SQLAlchemy engine

split_source_mapping