Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixing manual mysql quickstart
  • Loading branch information
jjoyce0510 committed Jun 30, 2021
commit 9627079c1982a34b45e192778c84fc9b28d074c7
8 changes: 6 additions & 2 deletions docker/quickstart/generate_docker_quickstart.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
from collections.abc import Mapping

import click
import yaml
from collections.abc import Mapping
from dotenv import dotenv_values
from shutil import copyfile
from yaml import Loader

# Generates a merged docker-compose file with env variables inlined.
Expand Down Expand Up @@ -81,6 +81,10 @@ def modify_docker_config(base_path, docker_yaml_config):
@click.argument("output-file", type=click.Path())
def generate(compose_files, output_file) -> None:

# Copy ../mysql/init.sql into the mysql directory
currDir = os.path.dirname(os.path.realpath(__file__))
copyfile(currDir + "/../mysql/init.sql", currDir + "/mysql/init.sql")

# Resolve .env files to inlined vars
modified_files = []
for compose_file in compose_files:
Expand Down
43 changes: 43 additions & 0 deletions docker/quickstart/mysql/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-- create metadata aspect table
CREATE TABLE metadata_aspect_v2 (
urn VARCHAR(500) NOT NULL,
aspect VARCHAR(200) NOT NULL,
version bigint(20) NOT NULL,
metadata longtext NOT NULL,
systemmetadata longtext,
createdon datetime(6) NOT NULL,
createdby VARCHAR(255) NOT NULL,
createdfor VARCHAR(255),
CONSTRAINT pk_metadata_aspect_v2 PRIMARY KEY (urn,aspect,version)
);

INSERT INTO metadata_aspect_v2 (urn, aspect, version, metadata, createdon, createdby) VALUES(
'urn:li:corpuser:datahub',
'corpUserInfo',
0,
'{"displayName":"Data Hub","active":true,"fullName":"Data Hub","email":"[email protected]"}',
now(),
'urn:li:principal:datahub'
), (
'urn:li:corpuser:datahub',
'corpUserEditableInfo',
0,
'{"skills":[],"teams":[],"pictureLink":"https://raw.githubusercontent.com/linkedin/datahub/master/datahub-web/packages/data-portal/public/assets/images/default_avatar.png"}',
now(),
'urn:li:principal:datahub'
);

-- create metadata index table
CREATE TABLE metadata_index (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`urn` VARCHAR(200) NOT NULL,
`aspect` VARCHAR(150) NOT NULL,
`path` VARCHAR(150) NOT NULL,
`longVal` BIGINT,
`stringVal` VARCHAR(200),
`doubleVal` DOUBLE,
CONSTRAINT id_pk PRIMARY KEY (id),
INDEX longIndex (`urn`,`aspect`,`path`,`longVal`),
INDEX stringIndex (`urn`,`aspect`,`path`,`stringVal`),
INDEX doubleIndex (`urn`,`aspect`,`path`,`doubleVal`)
);