> ## Documentation Index
> Fetch the complete documentation index at: https://ahen.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Add data to a table

> To add data to a table you will need to create a table

<Steps titleSize="h3">
  <Step title="Create tables">
    assuming you already create a schema file in the db/ folder we can create a table:

    ```python Python theme={"system"}
    # Create tables from the schema
    # This reads the schema from db/schema.py and creates all tables
    tables = client.get_or_create_table()
    # if the tables already exists the programe get them instead
    ```
  </Step>

  <Step title="Add data to a table">
    We can now add data to our tables.

    ```python Python theme={"system"}
    # Access your tables
    success_table = tables["success"]
    warning_table = tables["warning"]
    error_table = tables["error"]

    # Insert data
    # Insert success logs
    success_table.add(
        component="AuthService",
        action="login",
        message="User logged in successfully",
        user_id="user123"
    )

    # Insert warning logs
    warning_table.add(
        component="AuthService",
        action="login_attempt",
        message="Multiple failed login attempts",
        user_id="user456",
        details="5 failed attempts in 5 minutes"
    )

    # Insert error logs
    error_table.add(
        component="DatabaseService",
        action="connection",
        message="Connection timeout",
        user_id="system",
        details="Timeout after 30 seconds"
    )
    ```
  </Step>
</Steps>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.