Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rebasing from upstream master
Browse files Browse the repository at this point in the history
samshuster committed Mar 17, 2020
1 parent 2081933 commit 495f3be
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions databuilder/extractor/neo4j_search_data_extractor.py
Original file line number Diff line number Diff line change
@@ -23,19 +23,24 @@ class Neo4jSearchDataExtractor(Extractor):
<-[:SCHEMA_OF]-(schema:Schema)<-[:TABLE_OF]-(table:Table)
{publish_tag_filter}
OPTIONAL MATCH (table)-[:DESCRIPTION]->(table_description:Description)
OPTIONAL MATCH (table)-[:DESCRIPTION]->(prog_descs:Programmatic_Description)
OPTIONAL MATCH (table)-[:TAGGED_BY]->(tags:Tag) WHERE tags.tag_type='default'
WITH db, cluster, schema, table, table_description, COLLECT(DISTINCT tags.key) as tags
WITH db, cluster, schema, table, table_description,
COLLECT(prog_descs.description) as programmatic_descriptions,
COLLECT(DISTINCT tags.key) as tags
OPTIONAL MATCH (table)-[:TAGGED_BY]->(badges:Tag) WHERE badges.tag_type='badge'
WITH db, cluster, schema, table, table_description, tags, COLLECT(DISTINCT badges.key) as badges
WITH db, cluster, schema, table, table_description, programmatic_descriptions, tags,
COLLECT(DISTINCT badges.key) as badges
OPTIONAL MATCH (table)-[read:READ_BY]->(user:User)
WITH db, cluster, schema, table, table_description, tags, badges, SUM(read.read_count) AS total_usage,
WITH db, cluster, schema, table, table_description, programmatic_descriptions, tags, badges,
SUM(read.read_count) AS total_usage,
COUNT(DISTINCT user.email) as unique_usage
OPTIONAL MATCH (table)-[:COLUMN]->(col:Column)
OPTIONAL MATCH (col)-[:DESCRIPTION]->(col_description:Description)
WITH db, cluster, schema, table, table_description, tags, badges, total_usage, unique_usage,
WITH db, cluster, schema, table, table_description,
programmatic_descriptions, tags, badges, total_usage, unique_usage,
COLLECT(col.name) AS column_names, COLLECT(col_description.description) AS column_descriptions
OPTIONAL MATCH (table)-[:LAST_UPDATED_AT]->(time_stamp:Timestamp)
OPTIONAL MATCH (table)-[:DESCRIPTION]->(programmatic_description:Programmatic_Description)
RETURN db.name as database, cluster.name AS cluster, schema.name AS schema,
table.name AS name, table.key AS key, table_description.description AS description,
time_stamp.last_updated_timestamp AS last_updated_timestamp,
@@ -44,7 +49,8 @@ class Neo4jSearchDataExtractor(Extractor):
total_usage,
unique_usage,
tags,
badges
badges,
programmatic_descriptions
ORDER BY table.name;
"""
)

0 comments on commit 495f3be

Please sign in to comment.