Skip to content
Snippets Groups Projects
Commit d75a086a authored by julian's avatar julian
Browse files

renamed container sub_pg in preparation for other changes

parent 3bbce6f9
No related branches found
No related tags found
No related merge requests found
# ma_code # ma_code
Dieses Repo beinhaltet den Code und die Datasets zur Bachelorarbeit "Optimierung der Verwaltung von Graph-Daten in einem relationalen DBMS" von Julian Opitz Dieses Repo beinhaltet den Code zur Bachelorarbeit "Optimierung der Verwaltung von Graph-Daten in einem relationalen DBMS" von Julian Opitz
## setup ## setup
...@@ -9,7 +9,7 @@ Folgende dateien herunterladen: ...@@ -9,7 +9,7 @@ Folgende dateien herunterladen:
[ta1-cadets-e3-official-1.json.tar.gz](https://drive.google.com/file/d/1EycO23tEvZVnN3VxOHZ7gdbSCwqEZTI1/view?usp=drive_link) [ta1-cadets-e3-official-1.json.tar.gz](https://drive.google.com/file/d/1EycO23tEvZVnN3VxOHZ7gdbSCwqEZTI1/view?usp=drive_link)
[ta1-cadets-e3-official-2.json.tar.gz](https://drive.google.com/file/d/1AcWrYiBmgAqp7DizclKJYYJJBQbnDMfb/view?usp=drive_link) [ta1-cadets-e3-official-2.json.tar.gz](https://drive.google.com/file/d/1AcWrYiBmgAqp7DizclKJYYJJBQbnDMfb/view?usp=drive_link)
TODO datenformatierungsscript schreiben TODO datenformatierungsscript schreiben (entpacken, umbenennen, in zip komprimieren. alternativ endlich avro verwenden)
postgres_pass und .pgpass müssen unter linux 0600 Berechtigung haben. postgres_pass und .pgpass müssen unter linux 0600 Berechtigung haben.
......
...@@ -12,9 +12,9 @@ services: ...@@ -12,9 +12,9 @@ services:
- data.zip - data.zip
depends_on: depends_on:
- mosquitto - mosquitto
- sub_pg - pg_inserter
sub_pg: pg_inserter:
build: streaming/sub/postgres build: streaming/sub/postgres
environment: environment:
- MOS_HOST - MOS_HOST
...@@ -49,7 +49,7 @@ services: ...@@ -49,7 +49,7 @@ services:
secrets: secrets:
- pgpass - pgpass
depends_on: depends_on:
- sub_pg - pg_inserter
mosquitto: mosquitto:
image: eclipse-mosquitto:latest image: eclipse-mosquitto:latest
......
...@@ -3,7 +3,7 @@ services: ...@@ -3,7 +3,7 @@ services:
volumes: volumes:
- ./postgres/initdb/02-initdb_edge_id_no_uuid_index.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro - ./postgres/initdb/02-initdb_edge_id_no_uuid_index.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro
sub_pg: pg_inserter:
environment: environment:
- EDGE_INSERTS=EDGE_INSERTS - EDGE_INSERTS=EDGE_INSERTS
- UUID_EDGES= - UUID_EDGES=
...@@ -4,7 +4,7 @@ services: ...@@ -4,7 +4,7 @@ services:
- ./postgres/initdb/02-initdb_edge_id.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro - ./postgres/initdb/02-initdb_edge_id.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro
- ./postgres/initdb/03-initdb_trigger_edge_id.sql:/docker-entrypoint-initdb.d/03-initdb.sql:ro - ./postgres/initdb/03-initdb_trigger_edge_id.sql:/docker-entrypoint-initdb.d/03-initdb.sql:ro
sub_pg: pg_inserter:
environment: environment:
- EDGE_INSERTS= - EDGE_INSERTS=
- UUID_EDGES= - UUID_EDGES=
...@@ -3,7 +3,7 @@ services: ...@@ -3,7 +3,7 @@ services:
volumes: volumes:
- ./postgres/initdb/02-initdb_edge_id.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro - ./postgres/initdb/02-initdb_edge_id.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro
sub_pg: pg_inserter:
environment: environment:
- EDGE_INSERTS=EDGE_INSERTS - EDGE_INSERTS=EDGE_INSERTS
- UUID_EDGES= - UUID_EDGES=
...@@ -3,7 +3,7 @@ services: ...@@ -3,7 +3,7 @@ services:
volumes: volumes:
- ./postgres/initdb/02-initdb_edge_uuid.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro - ./postgres/initdb/02-initdb_edge_uuid.sql:/docker-entrypoint-initdb.d/02-initdb.sql:ro
sub_pg: pg_inserter:
environment: environment:
- EDGE_INSERTS=EDGE_INSERTS - EDGE_INSERTS=EDGE_INSERTS
- UUID_EDGES=UUID_EDGES - UUID_EDGES=UUID_EDGES
...@@ -11,7 +11,7 @@ import psycopg ...@@ -11,7 +11,7 @@ import psycopg
Parameter_Query: TypeAlias = Tuple[str, Iterable[Sequence[Any]]] Parameter_Query: TypeAlias = Tuple[str, Iterable[Sequence[Any]]]
HEADER_SCHEMA: Final[bytes] = b"com.bbn.tc.schema.avro.cdm18." HEADER_SCHEMA: Final[bytes] = b"com.bbn.tc.schema.avro.cdm18."
NODE_TYPES: Final[dict] = { NODE_TYPES: Final[dict] = {
# python trap: significant trailing commas # Python trap: Tuple with exactly one item must have trailing comma. Can you spot all 3?
"Event": ( "Event": (
("is_generated_by", ("subject", "UUID")), ("is_generated_by", ("subject", "UUID")),
("affects", ("predicateObject", "UUID")), ("affects", ("predicateObject", "UUID")),
...@@ -30,7 +30,6 @@ NODE_TYPES: Final[dict] = { ...@@ -30,7 +30,6 @@ NODE_TYPES: Final[dict] = {
"SrcSinkObject": (), "SrcSinkObject": (),
"Principal": (), "Principal": (),
"Host": (), "Host": (),
# python trap: significant trailing commas
} }
...@@ -71,6 +70,7 @@ def format_edge_uuid(nodes: Sequence[Tuple[str, str, dict]]) -> Parameter_Query: ...@@ -71,6 +70,7 @@ def format_edge_uuid(nodes: Sequence[Tuple[str, str, dict]]) -> Parameter_Query:
return ("INSERT INTO edge (source, destination, type) VALUES (%s, %s, %s)", edges) return ("INSERT INTO edge (source, destination, type) VALUES (%s, %s, %s)", edges)
# currently produces malformed SQL when there are no edges
def format_edge_id(nodes: Sequence[Tuple[str, str, dict]]) -> Tuple[str, Sequence[str]]: def format_edge_id(nodes: Sequence[Tuple[str, str, dict]]) -> Tuple[str, Sequence[str]]:
edges = [edge for node in nodes for edge in get_edges(*node)] edges = [edge for node in nodes for edge in get_edges(*node)]
query_str = ( query_str = (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment