Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CrispenGari committed Jan 31, 2024
1 parent cd26b49 commit fb7abe4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,18 @@ With the `delete_by_pk` method you can delete a record in a database based on th
affected_rows = db.delete_by_pk(User, userId)
```

You cal also use `filters` to delete a record in a database. The `delete_one` function allows you to delete a single record in a database that matches a filter.

```py
affected_rows = db.delete_one(User, {"name": "Crispen"})
```

You can also the `delete_bulk` which delete a lot of records that matches a filter:

```py
affected_rows = db.delete_bulk(User, {"name": "Crispen"})
```

### Associations

With `dataloom` you can define models that have relationships. Let's say we have a model called `Post` and every post should belong to a single `User`. Here is how you can define model mappings between a `Post` and a `User` using the `ForeignKeyColumn()`
Expand Down
4 changes: 2 additions & 2 deletions todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
2. inserting data ✅
3. created at and updated at field ✅
4. foreign key and primary key ✅
5. Foreign key Column
6. Delete table
5. Foreign key Column
6. Delete table data ✅


0 comments on commit fb7abe4

Please sign in to comment.