Guillotina comes with a great set of commands you can use to help debug and inspect your install.

We’ve already gone through the serve, create and testdata commands so we’ll now cover shell and run.

Make sure to also read the commands reference in the docs to learn how to create your own commands.


The shell command allows you to get an interactive prompt into guillotina.

From here, you can connect to the database, accees objects and commit new data.

g -c config.yml shell

Then, to connect to the database and get your container object.

txn = await use_db('db')
container = await use_container('container')

From here, you can access objects:

conversations = await container.async_get('conversations')
await conversations.async_keys()


The run command allows you to run a python script directly.

g -c config.yaml run --script=path/to/

To utilize this, the script must have an async function named run inside it.


In this example, we are going through all the conversations and adding a user to them.

from guillotina.transactions import transaction

async def run(container):
    conversations = await container.async_get('conversations')
    async for conversation in conversations.async_values():
        if 'foobar' in conversation.users:
        async with transaction():
            print(f'Fixing {conversation}')
            conversation.register()  # register object with current transaction