Dataloom

Latest version: v2.4.2

Safety actively analyzes 691343 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

2.4.2

===

Release Notes - `dataloom`

We have release the new `dataloom` Version `2.4.2` (`2024-04-11`)

Changes

- updated documentation
- documentation available on Read the Docs.

===

2.4.1

===

Release Notes - `dataloom`

We have release the new `dataloom` Version `2.4.1` (`2024-03-02`)

Changes

- Updated documentation.

===

2.4.0

===

Release Notes - `dataloom`

We have release the new `dataloom` Version `2.4.0` (`2024-02-27`)

Features

- `sync` and `connect_and_sync` function can now take in a collection of `Model` or a single `Model` instance.
- Updated documentation.
- Fixing `ForeignKeyColumn` bugs.
- Adding the `alias` as an argument to `Include` class so that developers can flexibly use their own alias for eager model inclusion rather than letting `dataloom` decide for them.
- Adding the `junction_table` as an argument to the `Include` so that we can use this table as a reference for `N-N` associations.
- Introducing self relations

- now you can define self relations in `dataloom`

py
class Employee(Model):
__tablename__: TableColumn = TableColumn(name="employees")
id = PrimaryKeyColumn(type="int", auto_increment=True)
name = Column(type="text", nullable=False, default="Bob")
supervisorId = ForeignKeyColumn(
"Employee", maps_to="1-1", type="int", required=False
)


- You can also do eager self relations queries

py
emp_and_sup = mysql_loom.find_by_pk(
instance=Employee,
pk=2,
select=["id", "name", "supervisorId"],
include=Include(
model=Employee,
has="one",
select=["id", "name"],
alias="supervisor",
),
)
print(emp_and_sup) ? = {'id': 2, 'name': 'Michael Johnson', 'supervisorId': 1, 'supervisor': {'id': 1, 'name': 'John Doe'}}



- Introducing `N-N` relationship

- with this version of `dataloom` `n-n` relationships are now available. However you will need to define a reference table manual. We recommend you to follow our documentation to get the best out of it.

py
class Course(Model):
__tablename__: TableColumn = TableColumn(name="courses")
id = PrimaryKeyColumn(type="int", auto_increment=True)
name = Column(type="text", nullable=False, default="Bob")

class Student(Model):
__tablename__: TableColumn = TableColumn(name="students")
id = PrimaryKeyColumn(type="int", auto_increment=True)
name = Column(type="text", nullable=False, default="Bob")

class StudentCourses(Model):
__tablename__: TableColumn = TableColumn(name="students_courses")
studentId = ForeignKeyColumn(table=Student, type="int")
courseId = ForeignKeyColumn(table=Course, type="int")


- you can do `eager` data fetching in this type of relationship, however you need to specify the `junction_table`. Here is an example:

py
english = mysql_loom.find_by_pk(
Course,
pk=engId,
select=["id", "name"],
include=Include(model=Student, junction_table=StudentCourses, has="many"),
)


===

2.3.0

===

Release Notes - `dataloom`

We have release the new `dataloom` Version `2.3.0` (`2024-02-26`)

Features

- updated documentation.
- Query Builder in executing queries and SQL Scripts.

py
qb = loom.getQueryBuilder()
res = qb.run("select id from posts;", fetchall=True)
print(res)


We can use the query builder to execute the SQL as follows:

py
with open("qb.sql", "r") as reader:
sql = reader.read()
res = qb.run(
sql,
fetchall=True,
is_script=True,
)
print(res)


> 👍 **Pro Tip:** Executing a script using query builder does not return a result. The result value is always `None`.

===

2.2.0

===

Release Notes - `dataloom`

We have release the new `dataloom` Version `2.2.0` (`2024-02-25`)

Features

- updated documentation.
- Added operators `BETWEEN` and `NOT` in filters now ypu can use them.

py
post = loom.find_one(
Post,
filters=Filter(
column="id",
operator="between",
value=[1, 7],
),
select=["id"],
)
post = loom.find_one(
Post,
filters=Filter(
column="id",
operator="not",
value=3,
),
select=["id"],
)


> Note that the `between` operator works on value ranges that are numbers.

- Distinct row selection has been added for the method `find_all()` and `find_many()`

py
post = loom.find_many(
Post,
filters=Filter(
column="id",
operator="between",
value=[1, 7],
),
select=["completed"],
distinct=True,
)

post = loom.find_all(
Post,
select=["completed"],
distinct=True,
)


> The result will return the `distinct` rows of data based on the completed value.

- added utility functions `sum`, `avg`, `min`, `max` and `count` to the loom object.
py
count = loom.count(
instance=Post,
filters=Filter(
column="id",
operator="between",
value=[1, 7],
),
column="id",
)

- Updated logger colors and formatting.

2.1.1

Release Notes - `dataloom`

We have release the new `dataloom` Version `2.1.1` (`2024-02-24`)

Features

- updated documentation.

===

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.