-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
156 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
# Copyright 2017-present Kensho Technologies, LLC. | ||
from .common import CompilationResult, compile_graphql_to_gremlin, compile_graphql_to_match # noqa | ||
from .common import GREMLIN_LANGUAGE, MATCH_LANGUAGE # noqa | ||
from .common import ( # noqa | ||
CompilationResult, | ||
compile_graphql_to_gremlin, | ||
compile_graphql_to_match, | ||
compile_graphql_to_sql, | ||
) | ||
from .common import GREMLIN_LANGUAGE, MATCH_LANGUAGE, SQL_LANGUAGE # noqa | ||
from .compiler_frontend import OutputMetadata # noqa |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright 2018-present Kensho Technologies, LLC. | ||
"""Transform a tree representation of an SQL query into an executable SQLAlchemy query.""" | ||
|
||
|
||
def emit_code_from_ir(sql_query_tree, compiler_metadata): | ||
"""Return a SQLAlchemy Query from a passed tree representation of an SQL query.""" | ||
raise NotImplementedError(u'SQL query emitting is not yet supported.') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2018-present Kensho Technologies, LLC. | ||
|
||
############## | ||
# Public API # | ||
############## | ||
|
||
|
||
def lower_ir(ir_blocks, query_metadata_table, type_equivalence_hints=None): | ||
"""Lower the IR into a form that can be represented by a SQL query. | ||
Args: | ||
ir_blocks: list of IR blocks to lower into SQL-compatible form | ||
query_metadata_table: QueryMetadataTable object containing all metadata collected during | ||
query processing, including location metadata (e.g. which locations | ||
are folded or optional). | ||
type_equivalence_hints: optional dict of GraphQL interface or type -> GraphQL union. | ||
Used as a workaround for GraphQL's lack of support for | ||
inheritance across "types" (i.e. non-interfaces), as well as a | ||
workaround for Gremlin's total lack of inheritance-awareness. | ||
The key-value pairs in the dict specify that the "key" type | ||
is equivalent to the "value" type, i.e. that the GraphQL type or | ||
interface in the key is the most-derived common supertype | ||
of every GraphQL type in the "value" GraphQL union. | ||
Recursive expansion of type equivalence hints is not performed, | ||
and only type-level correctness of this argument is enforced. | ||
See README.md for more details on everything this parameter does. | ||
***** | ||
Be very careful with this option, as bad input here will | ||
lead to incorrect output queries being generated. | ||
***** | ||
Returns: | ||
tree representation of IR blocks for recursive traversal by SQL backend. | ||
""" | ||
raise NotImplementedError(u'SQL IR lowering is not yet implemented.') |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ funcy==1.7.3 | |
graphql-core==1.1 | ||
pytz==2017.2 | ||
six==1.10.0 | ||
sqlalchemy==1.2.9 |
This file contains 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