Skip to content

Commit 925cbd5

Browse files
author
desiena
committed
Progress
1 parent aa78983 commit 925cbd5

20 files changed

Lines changed: 3127 additions & 628 deletions

.coveragerc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[run]
2+
omit =
3+
tests/*
4+
5+
[report]
6+
omit =
7+
tests/*

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ celerybeat.pid
123123

124124
# Environments
125125
tests/.env
126+
tests/.env_fms17
127+
tests/.env_fms22
126128
.venv
127129
env/
128130
venv/

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ students = Student.objects.order_by("pk").find(full_name__raw="*")
8787

8888
# Find students with exact match (equivalent to __exact)
8989
student_john = Student.objects.find(full_name="John Doe") # Searches for exact match
90-
students_of_2024_but_not_john = Student.objects.find(graduation_year=2024).omit(full_name="John Doe") # Searches for students graduating in 2024 but not named John Doe
90+
students_of_2024_but_not_john = Student.objects.find(graduation_year=2024).omit(
91+
full_name="John Doe") # Searches for students graduating in 2024 but not named John Doe
9192

9293
# Query with chunking and portal prefetching
9394
result_set = (Student.objects
9495
.order_by("pk")
95-
.find(full_name__raw="*") # __raw means filemaker raw query, so it will search for all students with a non-empty full_name
96-
.chunk_size(1000) # Call the API in chunks of 1000 records (in this example, it will return all students)
96+
.find(
97+
full_name__raw="*") # __raw means filemaker raw query, so it will search for all students with a non-empty full_name
98+
.chunking(1000) # Call the API in chunks of 1000 records (in this example, it will return all students)
9799
.prefetch_portal("classes", limit=100)
98100
)[:1000] # Limit to first 1000 records
99101

@@ -196,7 +198,7 @@ first_10 = Student.objects.find()[0:10]
196198
next_10 = Student.objects.find()[10:20]
197199

198200
# Chunked processing for large datasets
199-
for student in Student.objects.find().chunk_size(1000):
201+
for student in Student.objects.find().chunking(1000):
200202
process_student(student)
201203
```
202204

@@ -217,7 +219,7 @@ for student in students:
217219
classes = student.classes.only_prefetched()
218220

219221
# Or force to fetch fresh portal data
220-
classes = student.classes.avoid_prefetch_cache()
222+
classes = student.classes.ignore_prefetched()
221223

222224
# Create new portal records
223225
student.classes.create(name="New Class", description="Description")

data_types.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Pay attention:
2+
if you use Float you can lose precision during reading both with Number and Text. (use Decimal or String if you need full precision)
3+
if you use DateTime, if you have timezone information, you will lose timezone information while writing to FMFieldType.DateTime. If you write to FMFieldType.Text it will write the full ISO rappresentation of the datetime, so no timezone information will be lost.
4+
if you use String -> FMFieldType.DateTime, the string has to be an ISO rappresentation. If it have timezone information, it will be lost.
5+
if you use Container -> To update the container value, use model.update_container(container_name, file) the model.refresh_from_db()
6+
if you use Bool -> set true_value=X, false_value=Y, to choose what to write in the field. Set truthy=[list of values considered true] and falsy=[list of values considered false] to choose what to consider true/false when reading from FM

fmdata/__init__.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
from .const import FMErrorEnum
2-
from .fmclient import FMClient
3-
from .orm import Model, PortalField, PortalModel, PortalManager
2+
from .fmclient import FMClient, FMVersion
3+
from .orm import Model, PortalField, PortalModel, PortalManager
4+
from .fmd_fields import (
5+
FMFieldType,
6+
String,
7+
Integer,
8+
Float,
9+
Decimal,
10+
Bool,
11+
Date,
12+
DateTime,
13+
Time,
14+
)

0 commit comments

Comments
 (0)