Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mitm-tooling
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Machine Data
mitm-tooling
Commits
87d72953
Commit
87d72953
authored
1 month ago
by
Leah Tacke genannt Unterberg
Browse files
Options
Downloads
Patches
Plain Diff
maybe fixed another syntax error
parent
ea1ada47
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mitm_tooling/representation/sql_representation.py
+8
-8
8 additions, 8 deletions
mitm_tooling/representation/sql_representation.py
mitm_tooling/transformation/sql/into_mappings.py
+0
-1
0 additions, 1 deletion
mitm_tooling/transformation/sql/into_mappings.py
with
8 additions
and
9 deletions
mitm_tooling/representation/sql_representation.py
+
8
−
8
View file @
87d72953
...
...
@@ -74,12 +74,12 @@ def mk_link_table_name(mitm: MITM, concept: ConceptName, type_name: RelationName
return
mk_type_table_name
(
mitm
,
concept
,
type_name
)
+
'
_
'
+
fk_name
.
lower
()
def
has_type_tables
(
mitm
:
MITM
,
concept
:
ConceptName
)
->
bool
:
return
get_
mitm_def
(
mitm
)
.
get_properties
(
concept
).
permit_attributes
def
has_type_tables
(
mitm
_def
:
MITM
Definition
,
concept
:
ConceptName
)
->
bool
:
return
mitm_def
.
get_properties
(
concept
).
permit_attributes
def
has_natural_pk
(
mitm
:
MITM
,
concept
:
ConceptName
)
->
bool
:
return
len
(
get_
mitm_def
(
mitm
)
.
get_identity
(
concept
))
>
0
def
has_natural_pk
(
mitm
_def
:
MITM
Definition
,
concept
:
ConceptName
)
->
bool
:
return
len
(
mitm_def
.
get_identity
(
concept
))
>
0
def
pick_table_pk
(
mitm
:
MITM
,
concept
:
ConceptName
,
created_columns
:
ColumnsDict
)
->
ColumnsDict
|
None
:
...
...
@@ -87,7 +87,7 @@ def pick_table_pk(mitm: MITM, concept: ConceptName, created_columns: ColumnsDict
concept_properties
,
concept_relations
=
mitm_def
.
get
(
concept
)
prepended_cols
=
None
if
not
has_natural_pk
(
mitm
,
concept
):
if
not
has_natural_pk
(
mitm
_def
,
concept
):
prepended_cols
=
lambda
:
[
_within_concept_id_col
(
mitm
,
concept
)]
names
,
mapped_names
=
map_col_groups
(
mitm_def
,
concept
,
{
'
kind
'
:
lambda
:
'
kind
'
,
...
...
@@ -193,7 +193,7 @@ def _gen_denormalized_views(mitm: MITM, concept_tables: ConceptTablesDict, type_
for
concept
in
mitm_def
.
get_leafs
(
main_concept
):
view_name
=
mk_concept_table_name
(
mitm
,
concept
)
+
'
_denormalized_view
'
q
=
None
if
has_type_tables
(
mitm
,
concept
):
if
has_type_tables
(
mitm
_def
,
concept
):
selections
=
[]
for
leaf_concept
in
mitm_def
.
get_leafs
(
concept
):
...
...
@@ -288,7 +288,7 @@ def mk_sql_rep_schema(header: Header,
_gen_foreign_key_constraints
,)
if
not
skip_fk_constraints
else
base_schema_item_generators
for
he
in
header
.
header_entries
:
he_concept
=
he
.
concept
if
has_type_tables
(
header
.
mitm
,
he_concept
):
if
has_type_tables
(
mitm
_def
,
he_concept
):
concept_properties
,
concept_relations
=
mitm_def
.
get
(
he_concept
)
table_name
=
mk_type_table_name
(
header
.
mitm
,
he_concept
,
he
.
type_name
)
...
...
@@ -364,7 +364,7 @@ def _insert_type_df(conn: sa.Connection,
type_df
=
type_df
.
assign
(
**
{
concept_id_col_name
:
artificial_ids
})
conn
.
execute
(
t_concept
.
insert
(),
_df_to_table_records
(
type_df
,
t_concept
))
inserted_rows
=
no_instances
if
has_type_tables
(
mitm
,
concept
):
if
has_type_tables
(
mitm
_def
,
concept
):
# generated_ids = conn.execute(sa.select(t_concept.columns[concept_id_col_name])).scalars()
t_type
=
sql_rep_schema
.
type_tables
[
concept
][
type_name
]
conn
.
execute
(
t_type
.
insert
(),
_df_to_table_records
(
type_df
,
t_type
))
...
...
This diff is collapsed.
Click to expand it.
mitm_tooling/transformation/sql/into_mappings.py
+
0
−
1
View file @
87d72953
from
mitm_tooling.extraction.sql.data_models
import
SourceDBType
from
mitm_tooling.extraction.sql.mapping
import
ConceptMapping
,
ForeignRelation
from
mitm_tooling.representation
import
Header
,
SQLRepresentationSchema
from
mitm_tooling.representation.sql_representation
import
has_type_tables
def
sql_rep_into_mappings
(
header
:
Header
,
sql_rep_schema
:
SQLRepresentationSchema
)
->
list
[
ConceptMapping
]:
...
...
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