Skip to content

Commit

Permalink
Test Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Jul 27, 2024
1 parent b657322 commit ad1d8bb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/data/core/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ min: &min
max: &max
spark-version: 3.5.1
pydantic-version: 2
python-version: '3.12'
python-version: '3.13.0-beta.4'
java-version: 20
os: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/ftp/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ min: &min

max: &max
pydantic-version: 2
python-version: '3.12'
python-version: '3.13.0-beta.4'
os: ubuntu-latest

latest: &latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/ftps/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ min: &min

max: &max
pydantic-version: 2
python-version: '3.12'
python-version: '3.13.0-beta.4'
os: ubuntu-latest

latest: &latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/hdfs/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ max: &max
hadoop-version: hadoop3-hdfs
spark-version: 3.5.1
pydantic-version: 2
python-version: '3.12'
python-version: '3.13.0-beta.4'
java-version: 20
os: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/s3/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ max: &max
minio-version: 2024.4.18
spark-version: 3.5.1
pydantic-version: 2
python-version: '3.12'
python-version: '3.13.0-beta.4'
java-version: 20
os: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/sftp/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ min: &min

max: &max
pydantic-version: 2
python-version: '3.12'
python-version: '3.13.0-beta.4'
os: ubuntu-latest

latest: &latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/webdav/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ min: &min

max: &max
pydantic-version: 2
python-version: '3.12'
python-version: '3.13.0-beta.4'
os: ubuntu-latest

latest: &latest
Expand Down
34 changes: 20 additions & 14 deletions onetl/strategy/incremental_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,11 @@

from etl_entities.hwm import HWM

from onetl.impl import BaseModel
from onetl.strategy.batch_hwm_strategy import BatchHWMStrategy
from onetl.strategy.hwm_strategy import HWMStrategy


class OffsetMixin(BaseModel):
hwm: Optional[HWM] = None
offset: Any = None

def fetch_hwm(self) -> None:
super().fetch_hwm()

if self.hwm and self.hwm.value is not None and self.offset is not None:
self.hwm -= self.offset


class IncrementalStrategy(OffsetMixin, HWMStrategy):
class IncrementalStrategy(HWMStrategy):
"""Incremental strategy for :ref:`db-reader`/:ref:`file-downloader`.
Used for fetching only new rows/files from a source
Expand Down Expand Up @@ -353,8 +341,17 @@ class IncrementalStrategy(OffsetMixin, HWMStrategy):
# current run will download only files which were not downloaded in previous runs
"""

hwm: Optional[HWM] = None
offset: Any = None

def fetch_hwm(self) -> None:
super().fetch_hwm()

if self.hwm and self.hwm.value is not None and self.offset is not None:
self.hwm -= self.offset

class IncrementalBatchStrategy(OffsetMixin, BatchHWMStrategy):

class IncrementalBatchStrategy(BatchHWMStrategy):
"""Incremental batch strategy for :ref:`db-reader`.
.. note::
Expand Down Expand Up @@ -669,6 +666,15 @@ class IncrementalBatchStrategy(OffsetMixin, BatchHWMStrategy):
"""

hwm: Optional[HWM] = None
offset: Any = None

def fetch_hwm(self) -> None:
super().fetch_hwm()

if self.hwm and self.hwm.value is not None and self.offset is not None:
self.hwm -= self.offset

def __next__(self):
self.save_hwm()
return super().__next__()
Expand Down

0 comments on commit ad1d8bb

Please sign in to comment.