Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hshetl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tools
hshetl
Commits
f09558a8
Commit
f09558a8
authored
10 years ago
by
Dennis Ahrens
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Fixes join collidies.
parent
2c29be1a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
hshetl/entities.py
+15
-7
15 additions, 7 deletions
hshetl/entities.py
with
15 additions
and
7 deletions
hshetl/entities.py
+
15
−
7
View file @
f09558a8
...
...
@@ -100,9 +100,8 @@ class Entity(AbstractRepository):
container_identifier
=
self
.
_hash
(
container_fields
)
if
container_identifier
in
container
:
rec
=
Record
(
join_identifier
,
self
.
properties
,
self
.
itervalues
())
rec
.
load
(
container_fields
,
mapped_record
,
container
)
container
.
container_collide
(
rec
)
container
.
container_collide
(
join_identifier
,
self
.
properties
,
self
.
itervalues
(),
container_fields
,
mapped_record
,
container
)
return
if
self
.
record_repository
.
has
(
join_identifier
):
...
...
@@ -114,7 +113,8 @@ class Entity(AbstractRepository):
self
.
record_repository
.
add
(
record
)
container
.
append
(
container_identifier
)
except
DuplicatedSystemIdException
:
container
.
join_collide
(
Record
(
join_identifier
,
self
.
properties
,
self
.
itervalues
()))
container
.
join_collide
(
join_identifier
,
self
.
properties
,
self
.
itervalues
(),
container_fields
,
mapped_record
,
container
)
def
add
(
self
,
container
):
'''
Adds the container to the entity and register it at all records
'''
...
...
@@ -212,8 +212,15 @@ class Container(list):
value
=
raw_value
return
(
mapped_prop_name
,
value
)
def
container_collide
(
self
,
record
):
def
_create_collision_record
(
self
,
join_identifier
,
properties
,
containers
,
container_fields
,
mapped_record
,
container
):
'''
Create a record object, if there was a container or join collision.
'''
rec
=
Record
(
join_identifier
,
properties
,
containers
)
rec
.
load
(
container_fields
,
mapped_record
,
container
)
return
rec
def
container_collide
(
self
,
join_identifier
,
properties
,
containers
,
container_fields
,
mapped_record
,
container
):
'''
Add a container collisions or break.
'''
record
=
self
.
_create_collision_record
(
join_identifier
,
properties
,
containers
,
container_fields
,
mapped_record
,
container
)
if
self
.
collision_handling
==
COLLISION_HANDLING_BREAKALL
or
\
self
.
collision_handling
==
COLLISION_HANDLING_BREAKCONTAINER
:
msg
=
'
Collision in %s system detected! Aborting! %s found twice.
'
%
(
self
.
name
,
repr
(
record
))
...
...
@@ -223,8 +230,9 @@ class Container(list):
logging
.
warn
(
msg
)
self
.
collisions
.
append
(
record
)
def
join_collide
(
self
,
record
):
def
join_collide
(
self
,
join_identifier
,
properties
,
containers
,
container_fields
,
mapped_record
,
container
):
'''
Add a join collisions or break.
'''
record
=
self
.
_create_collision_record
(
join_identifier
,
properties
,
containers
,
container_fields
,
mapped_record
,
container
)
if
self
.
collision_handling
==
COLLISION_HANDLING_BREAKALL
or
\
self
.
collision_handling
==
COLLISION_HANDLING_BREAKJOIN
:
msg
=
'
Collision in %s system detected! Aborting! %s found twice.
'
%
(
self
.
name
,
repr
(
record
))
...
...
@@ -563,7 +571,7 @@ delete: {}
unaltered: {}
unknown: {}
collsions: {}
join_coll
o
sion: {}
join_coll
i
sion
s
: {}
'''
.
format
(
len
(
self
.
insert
),
len
(
self
.
update
),
len
(
self
.
delete
),
len
(
self
.
unaltered
),
len
(
self
.
unknown
),
len
(
self
.
collisions
),
len
(
self
.
join_collisions
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment