This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from mermaid_generator import BigQueryMermaidGenerator | |
| def generate_diagram(): | |
| # Initialize the generator with your project details | |
| generator = BigQueryMermaidGenerator( | |
| project_id="your-project-id", | |
| dataset_id="your-dataset" | |
| ) | |
| # Fetch schema and infer relationships |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import List, Optional | |
| from bq import Schema, Table, Column, BigQueryAnalyzer | |
| class MermaidGenerator: | |
| def __init__(self, schema: Schema): | |
| self.schema = schema | |
| self.relationships = [] | |
| def infer_relationships(self) -> None: | |
| """Infer relationships between tables based on column naming patterns.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Dict, List, Optional, Tuple | |
| from google.cloud import bigquery | |
| from dataclasses import dataclass | |
| import re | |
| @dataclass | |
| class Column: | |
| name: str | |
| type: str | |
| description: Optional[str] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from google.cloud import bigquery | |
| from typing import List, Dict, Optional | |
| import dataclasses | |
| from dataclasses import dataclass | |
| from typing import List, Optional | |
| @dataclass | |
| class Column: | |
| name: str | |
| type: str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Python unofficial Pushbullet client | |
| # (C) 2015 Patrick Lambert - http://dendory.net - Provided under MIT License | |
| import urllib.request | |
| import sys | |
| api_key = "XXXXXXXXX" | |
| title = "My Title" | |
| message = "My Body" | |
| def notify(key, title, text): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Error:Error while importing SBT project:<br/>...<br/><pre>[warn] Note: Unresolved dependencies path: | |
| [warn] org.scala-lang:scala-library:2.11 ((sbt.Classpaths) Defaults.scala#L1259) | |
| [warn] +- default:llr_2.11:1.0 | |
| [warn] org.apache.spark:spark-core:2.1.0 (/Users/jaimealmeida/Repos/Like2Vec/llr/build.sbt#L13-15) | |
| [warn] +- default:llr_2.11:1.0 | |
| [warn] com.eed3si9n:sbt-assembly:0.14.1 (scalaVersion=2.11, sbtVersion=0.13) (/Users/jaimealmeida/Repos/Like2Vec/llr/plugins.sbt#L5-6) | |
| [warn] +- default:llr_2.11:1.0 | |
| [warn] org.scala-lang:scala-compiler:2.11 | |
| [warn] +- default:llr_2.11:1.0 | |
| [trace] Stack trace suppressed: run 'last *:ssExtractProject' for the full output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name := "llr" | |
| version := "1.0" | |
| scalaVersion := "2.10.6" | |
| //scalaVersion := "2.11.8" | |
| resolvers++=Seq("Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", | |
| "releases" at "http://oss.sonatype.org/service/local/staging/deploy/maven2/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package lshinput | |
| import org.apache.spark.SparkContext | |
| import org.apache.spark.SparkContext._ | |
| import org.apache.spark.rdd.RDD | |
| import org.apache.spark.mllib.linalg.SparseVector | |
| import org.apache.spark.mllib.linalg.Vectors | |
| import com.github.karlhigley.spark.neighbors.ANN | |
| import org.apache.spark.SparkConf | |
| object LSHInput { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def urlses(cl: ClassLoader): Array[java.net.URL] = cl match { | |
| case null => Array() | |
| case u: java.net.URLClassLoader => u.getURLs() ++ urlses(cl.getParent) | |
| case _ => urlses(cl.getParent) | |
| } | |
| val urls = urlses(getClass.getClassLoader) | |
| println(urls.filterNot(_.toString.contains("ivy")).mkString("\n")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # | |
| # Python Timer Class - Context Manager for Timing Code Blocks | |
| # Corey Goldberg - 2012 | |
| # | |
| from timeit import default_timer | |
NewerOlder