Complex nested json data to dgraph

Hi, I am new to dgraph and graph database. Basically, I have to insert a JSON data to dgraph. The JSON I have is very complex and a little bit dynamic.

The data I am having is an SBOM report. Please find the sample below

{
“SchemaVersion”: 2,
“ArtifactName”: “dagflow-app:latest”,
“ArtifactType”: “container_image”,
“Metadata”: {
“OS”: {
“Family”: “debian”,
“Name”: “12.1”
},
“ImageID”: “sha256:346f866546896ea789c5c2fa6e86210082a83e620948dc2c52aa66835759ac4e”,
“DiffIDs”: [
“sha256:7c85cfa30cb11b7606c0ee84c713a8f6c9faad7cb7ba92f1f33ba36d4731cc82”,
“sha256:f6589095d5b5a4933db1a75edc905d20570c9f6e5dbebd9a7c39a8eef81bb3fd”,
“sha256:a981dddd4c650efa96d82013fba1d1189cf4648cd1e766b34120b32af9ce8a06”,
“sha256:01d6cdeac53917b874d5adac862ab90dcf22489b7914611a1bde7c84db0a99ae”,
“sha256:c26432533a6af2f6f59d50aba5f76f2b61c2e0088c7e01b5d2a8708b6cb9ef08”,
“sha256:950807b8113029e596ecd31900481c81d112069c2c644b9376b52d4f38080c9b”,
“sha256:8e61b2657a8166cc9e7166f9af2165295c60fec29501f3b19c7a502ca912bf3a”,
“sha256:9f64fe0537e89e159915c38bd700531a9bb6f21a6442b5a22040c4af6bf9f26b”,
“sha256:504957b5bc380781991e584c4dec22a4851b340da66efbcb48f1821e5dd5b7bb”,
“sha256:2f5d5ec1305274b3d5bc105edd9dfc87c49038e4f1956f3c89f8755c6008830b”,
“sha256:d1f91d6c5c8c3c3dd737516e440462bd54de1f79cea4975ad918a988e4ea912f”,
“sha256:2d661f5b9b0947e36d4cce9f4af907d76e8d21ca7b23ec13f5a72e29c310d535”,
“sha256:eb8eeef061d2bf930b1cf7bd1db6d1211be664905979524e5604a619423d8d5f”,
“sha256:dcfaefd67cfb108707cc35ba2c4a072cd70c69c6df7b8c31315529d5f7d03d42”,
“sha256:661f27320a54eae390a7f00515b4fe43447d3eda0bd4672bb633bdb5bb180fea”,
“sha256:7ed390f141a295fc8c91e0d4dd1aba2974d9ff55d8bc92f6e53ecfae3923e910”,
“sha256:32c61845a69a3e01d4a8e5f1128513572b676168215a6f2755e791a28ed884a8”
],
“RepoTags”: [
“dagflow-app:latest”
],
“ImageConfig”: {
“architecture”: “amd64”,
“created”: “2023-10-11T16:56:23.471034971+05:30”,
“history”: [
{
“created”: “2023-09-20T04:55:26Z”,
“created_by”: "_bin_sh -c #(nop) ADD file:ce04d6a354feaef93795269c859f36667fce9efda23c61b37d7060263b66ed4e in _ "
},
{
“created”: “2023-09-20T04:55:26Z”,
“created_by”: “_bin_sh -c #(nop) CMD ["bash"]”,
“empty_layer”: true
},
{
“created”: “2023-09-20T09:20:42Z”,
“created_by”: “_bin_sh -c set -eux; \tapt-get update; \tapt-get install -y --no-install-recommends \t\tca-certificates \t\tcurl \t\tgnupg \t\tnetbase \t\tsq \t\twget \t; \trm -rf var_lib_apt_lists"
},
{
“created”: “2023-09-20T09:21:02Z”,
“created_by”: "_bin_sh -c apt-get update && apt-get install -y --no-install-recommends \t\tgit \t\tmercurial \t\topenssh-client \t\tsubversion \t\t\t\tprocps \t&& rm -rf var_lib_apt_lists

},
{
“created”: “2023-09-20T09:21:58Z”,
“created_by”: “_bin_sh -c set -ex; \tapt-get update; \tapt-get install -y --no-install-recommends \t\tautoconf \t\tautomake \t\tbzip2 \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\timagemagick \t\tlibbz2-dev \t\tlibc6-dev \t\tlibcurl4-openssl-dev \t\tlibdb-dev \t\tlibevent-dev \t\tlibffi-dev \t\tlibgdbm-dev \t\tlibglib2.0-dev \t\tlibgmp-dev \t\tlibjpeg-dev \t\tlibkrb5-dev \t\tliblzma-dev \t\tlibmagickcore-dev \t\tlibmagickwand-dev \t\tlibmaxminddb-dev \t\tlibncurses5-dev \t\tlibncursesw5-dev \t\tlibpng-dev \t\tlibpq-dev \t\tlibreadline-dev \t\tlibsqlite3-dev \t\tlibssl-dev \t\tlibtool \t\tlibwebp-dev \t\tlibxml2-dev \t\tlibxslt-dev \t\tlibyaml-dev \t\tmake \t\tpatch \t\tunzip \t\txz-utils \t\tzlib1g-dev \t\t\t\t$( \t\t\tif apt-cache show ‘default-libmysqlclient-dev’ 2>_dev_null | grep -q ‘^Version:’; then \t\t\t\techo ‘default-libmysqlclient-dev’; \t\t\telse \t\t\t\techo ‘libmysqlclient-dev’; \t\t\tfi \t\t) \t; \trm -rf var_lib_apt_lists"
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV PATH=_usr_local_bin:_usr_local_sbin:_usr_local_bin:_usr_sbin:_usr_bin:_sbin:_bin”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV LANG=C.UTF-8”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: "RUN _bin_sh -c set -eux; \tapt-get update; \tapt-get install -y --no-install-recommends \t\tlibbluetooth-dev \t\ttk-dev \t\tuuid-dev \t; \trm -rf var_lib_apt_lists
# buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV PYTHON_VERSION=3.10.13”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “RUN bin_sh -c set -eux; \t\twget -O python.tar.xz "afadfsdfsdfwww.python.org_ftp_python${PYTHON_VERSION%%[a-z]}Python-$PYTHON_VERSION.tar.xz"; \twget -O python.tar.xz.asc "afadfsdfsdfwww.python.org_ftp_python${PYTHON_VERSION%%[a-z]}_Python-$PYTHON_VERSION.tar.xz.asc"; \tGNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \tgpg --batch --keyserver hkps:_keys.openpgp.org --recv-keys "$GPG_KEY"; \tgpg --batch --verify python.tar.xz.asc python.tar.xz; \tgpgconf --kill all; \trm -rf "$GNUPGHOME" python.tar.xz.asc; \tmkdir -p _usr_src_python; \ttar --extract --directory _usr_src_python --strip-components=1 --file python.tar.xz; \trm python.tar.xz; \t\tcd _usr_src_python; \tgnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \t.configure \t\t–build="$gnuArch" \t\t–enable-loadable-sqlite-extensions \t\t–enable-optimizations \t\t–enable-option-checking=fatal \t\t–enable-shared \t\t–with-lto \t\t–with-system-expat \t\t–without-ensurepip \t; \tnproc="$(nproc)"; \tEXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \tLDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \tmake -j "$nproc" \t\t"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \t\t"LDFLAGS=${LDFLAGS:-}" \t\t"PROFILE_TASK=${PROFILE_TASK:-}" \t; \trm python; \tmake -j "$nproc" \t\t"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \t\t"LDFLAGS=${LDFLAGS:–Wl},-rpath='\$\$ORIGIN…_lib’" \t\t"PROFILE_TASK=${PROFILE_TASK:-}" \t\tpython \t; \tmake install; \t\tbin="$(readlink -ve _usr_local_bin_python3)"; \tdir="$(dirname "$bin")"; \tmkdir -p "usr_share_gdb_auto-load$dir"; \tcp -vL Tools_gdb_libpython.py "usr_share_gdb_auto-load$bin-gdb.py"; \t\tcd _; \trm -rf _usr_src_python; \t\tfind _usr_local -depth \t\t\( \t\t\t\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \t\t\t-o \( -type f -a \( -name ‘.pyc’ -o -name '.pyo’ -o -name ‘libpython*.a’ \) \) \t\t\) -exec rm -rf ‘{}’ + \t; \t\tldconfig; \t\tpython3 --version # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “RUN _bin_sh -c set -eux; \tfor src in idle3 pydoc3 python3 python3-config; do \t\tdst="$(echo "$src" | tr -d 3)"; \t\t[ -s "usr_local_bin$src" ]; \t\t[ ! -e "usr_local_bin$dst" ]; \t\tln -svT "$src" "usr_local_bin$dst"; \tdone # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV PYTHON_PIP_VERSION=23.0.1”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV PYTHON_SETUPTOOLS_VERSION=65.5.1”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV PYTHON_GET_PIP_URL=afadfsdfsdfgithub.com_pypa_get-pip_raw_9af82b715db434abb94a0a6f3569f43e72157346_public_get-pip.py”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “ENV PYTHON_GET_PIP_SHA256=45a2bb8bf2bb5eff16fdd00faef6f29731831c7c59bd9fc2bf1f3bed511ff1fe”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “RUN _bin_sh -c set -eux; \t\twget -O get-pip.py "$PYTHON_GET_PIP_URL"; \techo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \t\texport PYTHONDONTWRITEBYTECODE=1; \t\tpython get-pip.py \t\t–disable-pip-version-check \t\t–no-cache-dir \t\t–no-compile \t\t"pip==$PYTHON_PIP_VERSION" \t\t"setuptools==$PYTHON_SETUPTOOLS_VERSION" \t; \trm -f get-pip.py; \t\tpip --version # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-08-24T15:49:13Z”,
“created_by”: “CMD ["python3"]”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-10-11T11:00:00Z”,
“created_by”: “ARG AIRFLOW_VERSION=2.5.3”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-10-11T11:00:00Z”,
“created_by”: “ARG PYTHON_VERSION=3.10”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
},
{
“created”: “2023-10-11T11:00:00Z”,
“created_by”: “RUN |2 AIRFLOW_VERSION=2.5.3 PYTHON_VERSION=3.10 _bin_sh -c echo ${AIRFLOW_VERSION} ${PYTHON_VERSION} # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:00:00Z”,
“created_by”: “RUN |2 AIRFLOW_VERSION=2.5.3 PYTHON_VERSION=3.10 _bin_sh -c echo "$(echo $PYTHON_VERSION | cut -d ‘.’ -f 1,2)" > version.txt # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:01:18Z”,
“created_by”: “RUN |2 AIRFLOW_VERSION=2.5.3 PYTHON_VERSION=3.10 _bin_sh -c VERSION_MAJOR_MINOR=$(cat version.txt) && pip install "apache-airflow[postgres,google]==${AIRFLOW_VERSION}" --constraint "afadfsdfsdfraw.githubusercontent.com_apache_airflow_constraints-${AIRFLOW_VERSION}_constraints-$VERSION_MAJOR_MINOR.txt" # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:01:21Z”,
“created_by”: “RUN |2 AIRFLOW_VERSION=2.5.3 PYTHON_VERSION=3.10 _bin_sh -c pip install plyvel # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:01:21Z”,
“created_by”: “WORKDIR _app”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:01:25Z”,
“created_by”: “RUN |2 AIRFLOW_VERSION=2.5.3 PYTHON_VERSION=3.10 _bin_sh -c pip install pyroscope-io # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:01:25Z”,
“created_by”: “COPY ._requirements.txt _app_requirements.txt # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:01:32Z”,
“created_by”: “RUN |2 AIRFLOW_VERSION=2.5.3 PYTHON_VERSION=3.10 _bin_sh -c pip install -r _app_requirements.txt # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:26:23Z”,
“created_by”: “COPY . _app # buildkit”,
“comment”: “buildkit.dockerfile.v0”
},
{
“created”: “2023-10-11T11:26:23Z”,
“created_by”: “EXPOSE map[8000_tcp:{}]”,
“comment”: “buildkit.dockerfile.v0”,
“empty_layer”: true
}
],
“os”: “linux”,
“rootfs”: {
“type”: “layers”,
“diff_ids”: [
“sha256:7c85cfa30cb11b7606c0ee84c713a8f6c9faad7cb7ba92f1f33ba36d4731cc82”,
“sha256:f6589095d5b5a4933db1a75edc905d20570c9f6e5dbebd9a7c39a8eef81bb3fd”,
“sha256:a981dddd4c650efa96d82013fba1d1189cf4648cd1e766b34120b32af9ce8a06”,
“sha256:01d6cdeac53917b874d5adac862ab90dcf22489b7914611a1bde7c84db0a99ae”,
“sha256:c26432533a6af2f6f59d50aba5f76f2b61c2e0088c7e01b5d2a8708b6cb9ef08”,
“sha256:950807b8113029e596ecd31900481c81d112069c2c644b9376b52d4f38080c9b”,
“sha256:8e61b2657a8166cc9e7166f9af2165295c60fec29501f3b19c7a502ca912bf3a”,
“sha256:9f64fe0537e89e159915c38bd700531a9bb6f21a6442b5a22040c4af6bf9f26b”,
“sha256:504957b5bc380781991e584c4dec22a4851b340da66efbcb48f1821e5dd5b7bb”,
“sha256:2f5d5ec1305274b3d5bc105edd9dfc87c49038e4f1956f3c89f8755c6008830b”,
“sha256:d1f91d6c5c8c3c3dd737516e440462bd54de1f79cea4975ad918a988e4ea912f”,
“sha256:2d661f5b9b0947e36d4cce9f4af907d76e8d21ca7b23ec13f5a72e29c310d535”,
“sha256:eb8eeef061d2bf930b1cf7bd1db6d1211be664905979524e5604a619423d8d5f”,
“sha256:dcfaefd67cfb108707cc35ba2c4a072cd70c69c6df7b8c31315529d5f7d03d42”,
“sha256:661f27320a54eae390a7f00515b4fe43447d3eda0bd4672bb633bdb5bb180fea”,
“sha256:7ed390f141a295fc8c91e0d4dd1aba2974d9ff55d8bc92f6e53ecfae3923e910”,
“sha256:32c61845a69a3e01d4a8e5f1128513572b676168215a6f2755e791a28ed884a8”
]
},
“config”: {
“Cmd”: [
“python3”
],
“Env”: [
“PATH=_usr_local_bin:_usr_local_sbin:_usr_local_bin:_usr_sbin:_usr_bin:_sbin:bin",
“LANG=C.UTF-8”,
“GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D”,
“PYTHON_VERSION=3.10.13”,
“PYTHON_PIP_VERSION=23.0.1”,
“PYTHON_SETUPTOOLS_VERSION=65.5.1”,
“PYTHON_GET_PIP_URL=afadfsdfsdfgithub.com_pypa_get-pip_raw_9af82b715db434abb94a0a6f3569f43e72157346_public_get-pip.py”,
“PYTHON_GET_PIP_SHA256=45a2bb8bf2bb5eff16fdd00faef6f29731831c7c59bd9fc2bf1f3bed511ff1fe”
],
“Labels”: {
“com.docker.compose.project”: “dagflow”,
“com.docker.compose.service”: “app”,
“com.docker.compose.version”: “2.20.2”
},
“WorkingDir”: “app",
“ArgsEscaped”: true
}
}
},
“Results”: [
{
“Target”: “dagflow-app:latest (debian 12.1)”,
“Class”: “os-pkgs”,
“Type”: “debian”,
“Vulnerabilities”: [
{
“VulnerabilityID”: “CVE-2011-3374”,
“PkgID”: “apt@2.6.1”,
“PkgName”: “apt”,
“InstalledVersion”: “2.6.1”,
“Status”: “affected”,
“Layer”: {
“DiffID”: “sha256:7c85cfa30cb11b7606c0ee84c713a8f6c9faad7cb7ba92f1f33ba36d4731cc82”
},
“SeveritySource”: “debian”,
“PrimaryURL”: “afadfsdfsdfavd.aquasec.com_nvd_cve-2011-3374”,
“DataSource”: {
“ID”: “debian”,
“Name”: “Debian Security Tracker”,
“URL”: “afadfsdfsdfsalsa.debian.org_security-tracker-team_security-tracker”
},
“Title”: “It was found that apt-key in apt, all versions, do not correctly valid …”,
“Description”: “It was found that apt-key in apt, all versions, do not correctly validate gpg keys with the master keyring, leading to a potential man-in-the-middle attack.”,
“Severity”: “LOW”,
“CweIDs”: [
“CWE-347”
],
“CVSS”: {
“nvd”: {
“V2Vector”: “AV:N_AC:M_Au:N_C:N_I:P_A:N”,
“V3Vector”: “CVSS:3.1_AV:N_AC:H_PR:N_UI:N_S:U_C:N_I:L_A:N”,
“V2Score”: 4.3,
“V3Score”: 3.7
}
},
“References”: [
“afadfsdfsdfaccess.redhat.com_security_cve_cve-2011-3374”,
“afadfsdfsdfbugs.debian.org_cgi-bin_bugreport.cgi?bug=642480”,
"afadfsdfsdfpeople.canonical.com
~ubuntu-security_cve_2011_CVE-2011-3374.html”,
“afadfsdfsdfseclists.org_fulldisclosure_2011_Sep_221”,
“afadfsdfsdfsecurity-tracker.debian.org_tracker_CVE-2011-3374”,
“afadfsdfsdfsnyk.io_vuln_SNYK-LINUX-APT-116518”,
“afadfsdfsdfubuntu.com_security_CVE-2011-3374”
],
“PublishedDate”: “2019-11-26T00:15:00Z”,
“LastModifiedDate”: “2021-02-09T16:08:00Z”
},
{
“VulnerabilityID”: “TEMP-0841856-B18BAF”,
“PkgID”: “bash@5.2.15-2+b2”,
“PkgName”: “bash”,
“InstalledVersion”: “5.2.15-2+b2”,
“Status”: “affected”,
“Layer”: {
“DiffID”: “sha256:7c85cfa30cb11b7606c0ee84c713a8f6c9faad7cb7ba92f1f33ba36d4731cc82”
},
“SeveritySource”: “debian”,
“PrimaryURL”: “afadfsdfsdfsecurity-tracker.debian.org_tracker_TEMP-0841856-B18BAF”,
“DataSource”: {
“ID”: “debian”,
“Name”: “Debian Security Tracker”,
“URL”: “afadfsdfsdfsalsa.debian.org_security-tracker-team_security-tracker”
},
“Title”: “[Privilege escalation possible to other user than root]”,
“Severity”: “LOW”
}
]
},
{
“Target”: “Python”,
“Class”: “lang-pkgs”,
“Type”: “python-pkg”,
“Vulnerabilities”: [
{
“VulnerabilityID”: “CVE-2023-30861”,
“PkgName”: “Flask”,
“PkgPath”: “usr_local_lib_python3.10_site-packages_Flask-2.2.3.dist-info_METADATA”,
“InstalledVersion”: “2.2.3”,
“FixedVersion”: “2.3.2, 2.2.5”,
“Status”: “fixed”,
“Layer”: {
“DiffID”: “sha256:d1f91d6c5c8c3c3dd737516e440462bd54de1f79cea4975ad918a988e4ea912f”
},
“SeveritySource”: “ghsa”,
“PrimaryURL”: “afadfsdfsdfavd.aquasec.com_nvd_cve-2023-30861”,
“DataSource”: {
“ID”: “ghsa”,
“Name”: “GitHub Security Advisory pip”,
“URL”: “afadfsdfsdfgithub.com_advisories?query=type%3Areviewed+ecosystem%3Apip”
},
“Title”: “flask: Possible disclosure of permanent session cookie due to missing Vary: Cookie header”,
“Description”: “Flask is a lightweight WSGI web application framework. When all of the following conditions are met, a response containing data intended for one client may be cached and subsequently sent by the proxy to other clients. If the proxy also caches Set-Cookie headers, it may send one client’s session cookie to other clients. The severity depends on the application’s use of the session and the proxy’s behavior regarding cookies. The risk depends on all these conditions being met.\n\n1. The application must be hosted behind a caching proxy that does not strip cookies or ignore responses with cookies.\n2. The application sets session.permanent = True\n3. The application does not access or modify the session at any point during a request.\n4. SESSION_REFRESH_EACH_REQUEST enabled (the default).\n5. The application does not set a Cache-Control header to indicate that a page is private or should not be cached.\n\nThis happens because vulnerable versions of Flask only set the Vary: Cookie header when the session is accessed or modified, not when it is refreshed (re-sent to update the expiration) without being accessed or modified. This issue has been fixed in versions 2.3.2 and 2.2.5.”,
“Severity”: “HIGH”,
“CweIDs”: [
“CWE-539”
],
“CVSS”: {
“ghsa”: {
“V3Vector”: “CVSS:3.1_AV:N_AC:L_PR:N_UI:N_S:U_C:H_I:N_A:N”,
“V3Score”: 7.5
},
“nvd”: {
“V3Vector”: “CVSS:3.1_AV:N_AC:L_PR:N_UI:N_S:U_C:H_I:N_A:N”,
“V3Score”: 7.5
},
“redhat”: {
“V3Vector”: “CVSS:3.1_AV:N_AC:L_PR:N_UI:N_S:U_C:H_I:N_A:N”,
“V3Score”: 7.5
}
},
“References”: [
“afadfsdfsdfaccess.redhat.com_security_cve_CVE-2023-30861”,
“afadfsdfsdfcve.mitre.org_cgi-bin_cvename.cgi?name=CVE-2023-30861”,
“afadfsdfsdfgithub.com_pallets_flask”,
“afadfsdfsdfgithub.com_pallets_flask_commit_70f906c51ce49c485f1d355703e9cc3386b1cc2b”,
“afadfsdfsdfgithub.com_pallets_flask_commit_8646edca6f47e2cd57464081b3911218d4734f8d (2.2.5)”,
“afadfsdfsdfgithub.com_pallets_flask_commit_8705dd39c4fa563ea0fe0bf84c85da8fcc98b88d (2.3.2)”,
“afadfsdfsdfgithub.com_pallets_flask_commit_afd63b16170b7c047f5758eb910c416511e9c965”,
“afadfsdfsdfgithub.com_pallets_flask_releases_tag_2.2.5”,
“afadfsdfsdfgithub.com_pallets_flask_releases_tag_2.3.2”,
“afadfsdfsdfgithub.com_pallets_flask_security_advisories_GHSA-m2qf-hxjv-5gpq”,
“afadfsdfsdfgithub.com_pypa_advisory-database_tree_main_vulns_flask_PYSEC-2023-62.yaml”,
“afadfsdfsdflinux.oracle.com_cve_CVE-2023-30861.html”,
“afadfsdfsdflinux.oracle.com_errata_ELSA-2023-12710.html”,
“afadfsdfsdflists.debian.org_debian-lts-announce_2023_08_msg00024.html”,
“afadfsdfsdfnvd.nist.gov_vuln_detail_CVE-2023-30861”,
"afadfsdfsdfsecurity.netapp.com_advisory_ntap-20230818-0006
”,
“afadfsdfsdfubuntu.com_security_notices_USN-6111-1”,
“afadfsdfsdfwww.cve.org_CVERecord?id=CVE-2023-30861”,
“afadfsdfsdfwww.debian.org_security_2023_dsa-5442”
],
“PublishedDate”: “2023-05-02T18:15:00Z”,
“LastModifiedDate”: “2023-08-20T21:15:00Z”
},
{
“VulnerabilityID”: “CVE-2023-29005”,
“PkgName”: “Flask-AppBuilder”,
“PkgPath”: “usr_local_lib_python3.10_site-packages_Flask_AppBuilder-4.1.4.dist-info_METADATA”,
“InstalledVersion”: “4.1.4”,
“FixedVersion”: “4.3.0”,
“Status”: “fixed”,
“Layer”: {
“DiffID”: “sha256:d1f91d6c5c8c3c3dd737516e440462bd54de1f79cea4975ad918a988e4ea912f”
},
“SeveritySource”: “ghsa”,
“PrimaryURL”: “afadfsdfsdfavd.aquasec.com_nvd_cve-2023-29005”,
“DataSource”: {
“ID”: “ghsa”,
“Name”: “GitHub Security Advisory pip”,
“URL”: “afadfsdfsdfgithub.com_advisories?query=type%3Areviewed+ecosystem%3Apip”
},
“Title”: “Flask-AppBuilder Has No Rate Limiting on Login AUTH DB”,
“Description”: “Flask-AppBuilder versions before 4.3.0 lack rate limiting which can allow an attacker to brute-force user credentials. Version 4.3.0 includes the ability to enable rate limiting using AUTH_RATE_LIMITED = True, RATELIMIT_ENABLED = True, and setting an AUTH_RATE_LIMIT.”,
“Severity”: “HIGH”,
“CweIDs”: [
“CWE-307”
],
“CVSS”: {
“ghsa”: {
“V3Vector”: “CVSS:3.1_AV:N_AC:L_PR:N_UI:N_S:U_C:H_I:N_A:N”,
“V3Score”: 7.5
},
“nvd”: {
“V3Vector”: “CVSS:3.1_AV:N_AC:L_PR:N_UI:N_S:U_C:H_I:N_A:N”,
“V3Score”: 7.5
}
},
“References”: [
“afadfsdfsdfflask-limiter.readthedocs.io_en_stable_configuration.html”,
“afadfsdfsdfgithub.com_dpgaspar_Flask-AppBuilder”,
“afadfsdfsdfgithub.com_dpgaspar_Flask-AppBuilder_pull_1976”,
“afadfsdfsdfgithub.com_dpgaspar_Flask-AppBuilder_releases_tag_v4.3.0”,
“afadfsdfsdfgithub.com_dpgaspar_Flask-AppBuilder_security_advisories_GHSA-9hcr-9hcv-x6pv”,
“afadfsdfsdfnvd.nist.gov_vuln_detail_CVE-2023-29005”
],
“PublishedDate”: “2023-04-10T21:15:00Z”,
“LastModifiedDate”: “2023-04-18T17:02:00Z”
}
]
}
]
}

I have to insert this to dgraph using pydgraph. How to do that?

Any help will be much appreciated. Thanks

My friend, please use code block formatting! (three backticks before and after the code)

To answer your question, there is not a one size fits all for storing JSON data in Dgraph. You title, calls your data “complex nested”, but the data schema is not really all that complex in terms of JSON. You should be able to write this data directly and query it back out with DQL. What you will need to watch out for and be aware of is the following:

  1. Handling of “Arrays” in Dgraph. Dgraph treats arrays like sets, so duplicates and order are not preserved.
  2. Lack of support for multi-dimensional arrays. I don’t see this in your dataset example, but just be aware of it.
  3. Predicate naming/typing. I don’t see this problem in your dataset either, but for instance, if in one place you used the key (aka predicate) “foo” to map to a string, and then later “foo” maps to an array or object, or even DateTime then you will have problems. The workaround to this is to prepend the type to the predicate like Dgraph does under the hood with GraphQL schema.
  4. Deep updating without having uids. This might not be that evident if just saving JSON data and not needing to modify it, but when you do need to modify it, modifying a nested portion of it can be tricky to do and usually you will find yourself appending to existing adding new nested nodes instead of modifying the existing nested nodes.
  5. Typing nested data. If you want your data to work with Dgraph types, then you will need to manually add the dgraph.type predicates to every object in your JSON data.

A workaround to all of this is to store the JSON as a string, but that might really take away the value of using Dgraph for your use case.