Skip to content

Commit

Permalink
updates-on-the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CrispenGari committed Feb 4, 2024
1 parent a98b503 commit ec4f0f3
Show file tree
Hide file tree
Showing 7 changed files with 2,145 additions and 1 deletion.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
<img src="/dataloom.png" alt="dataloom" width="200">
</p>

### ⚠️ Warning

> **⚠️ Experimental Status of `dataloom`**: The `dataloom` module is currently in an experimental phase. As such, we strongly advise against using it in production environments until a major version is officially released and stability is ensured. During this experimental phase, the `dataloom` module may undergo significant changes, and its features are subject to refinement. We recommend monitoring the project updates and waiting for a stable release before incorporating it into production systems. Please exercise caution and consider alternative solutions for production use until the module reaches a stable release.\*\*
### Table of Contents

- [dataloom](#dataloom)
- [⚠️ Warning](#️-warning)
- [Table of Contents](#table-of-contents)
- [Key Features:](#key-features)
- [Installation](#installation)
Expand All @@ -30,6 +35,8 @@
- [2. Getting records](#2-getting-records)
- [3. Getting a single record](#3-getting-a-single-record)
- [4. Deleting a record](#4-deleting-a-record)
- [Warning: Potential Risk with `delete_bulk()`](#warning-potential-risk-with-delete_bulk)
- [Guidelines for Safe Usage](#guidelines-for-safe-usage)
- [5. Updating a record](#5-updating-a-record)
- [Associations](#associations)
- [Pagination](#pagination)
Expand Down Expand Up @@ -522,6 +529,29 @@ You can also use the `delete_bulk()` method to delete a multitude of records tha
affected_rows = sqlite_loom.delete_bulk(User, {"name": "Crispen"})
```

#### Warning: Potential Risk with `delete_bulk()`

⚠️ **Warning:** When using the `delete_bulk()` function, exercise caution as it can be aggressive. If the filter is not explicitly provided, there is a risk of mistakenly deleting all records in the table.

##### Guidelines for Safe Usage

To mitigate the potential risks associated with `delete_bulk()`, follow these guidelines:

1. **Always Provide a Filter:**

- When calling `delete_bulk()`, make sure to provide a filter to specify the subset of records to be deleted. This helps prevent unintentional deletions.

```python
# Example: Delete records where 'status' is 'inactive'
sqlite_loom.delete_bulk(filter={'status': 'inactive'})
```

2. **Consider Usage When Necessary:**

- When contemplating data deletion, it is advisable to consider more targeted methods before resorting to `delete_bulk()`. Prioritize the use of `delete_one()` or `delete_by_pk()` methods to remove specific records based on your needs. This ensures a more precise and controlled approach to data deletion.

By following these guidelines, you can use the `delete_bulk()` function safely and minimize the risk of unintended data loss. Always exercise caution and adhere to best practices when performing bulk deletion operations.

#### 5. Updating a record

To update a record in a database table, you can utilize the methods `update_by_pk()`, `update_one()`, and `update_bulk()`. The `update_pk()` method can be used as follows:
Expand Down
2,089 changes: 2,089 additions & 0 deletions dataloom.sql

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions dataloom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dataloom.loom import Dataloom
from dataloom.keys import MySQLConfig, PgConfig
from dataloom.exceptions import (
InvalidColumnValuesException,
InvalidFiltersForTableColumnException,
Expand All @@ -17,3 +18,23 @@
Column,
TableColumn,
)

__all__ = [
MySQLConfig,
PgConfig,
InvalidColumnValuesException,
InvalidFiltersForTableColumnException,
PkNotDefinedException,
TooManyPkException,
UnknownColumnException,
UnsupportedDialectException,
UnsupportedTypeException,
PrimaryKeyColumn,
CreatedAtColumn,
ForeignKeyColumn,
UpdatedAtColumn,
Column,
Dataloom,
TableColumn,
Model,
]
Empty file removed dataloom/tests/test_delete.py
Empty file.
Binary file modified hi.db
Binary file not shown.
4 changes: 4 additions & 0 deletions playground.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import sys

print(sys.path)

from dataloom import (
Dataloom,
Model,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
description=DESCRIPTION,
long_description_content_type="text/markdown",
long_description=LON_DESCRIPTION,
packages=find_packages(),
packages=find_packages(exclude=["tests", "tests.*"]),
install_requires=[
"mysql-connector-python==8.3.0",
"psycopg2==2.9.9",
Expand Down

0 comments on commit ec4f0f3

Please sign in to comment.