[ https://issues.apache.org/jira/browse/BEAM-8603?focusedWorklogId=410536&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-410536 ]
ASF GitHub Bot logged work on BEAM-8603: ---------------------------------------- Author: ASF GitHub Bot Created on: 26/Mar/20 19:42 Start Date: 26/Mar/20 19:42 Worklog Time Spent: 10m Work Description: robertwb commented on pull request #10055: [BEAM-8603] Add Python SqlTransform URL: https://github.com/apache/beam/pull/10055#discussion_r398829354 ########## File path: sdks/python/apache_beam/transforms/sql.py ########## @@ -0,0 +1,44 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""Transforms that use the SQL Expansion service.""" + +# pytype: skip-file + +from __future__ import absolute_import + +import typing + +from past.builtins import unicode + +from apache_beam.transforms.external import BeamJarExpansionService +from apache_beam.transforms.external import ExternalTransform +from apache_beam.transforms.external import NamedTupleBasedPayloadBuilder + +SqlTransformSchema = typing.NamedTuple( + 'SqlTransformSchema', [('query', unicode)]) + + +class SqlTransform(ExternalTransform): + URN = 'beam:external:java:sql:v1' + + def __init__(self, query): + super(SqlTransform, self).__init__( + self.URN, + NamedTupleBasedPayloadBuilder(SqlTransformSchema(query=query)), + BeamJarExpansionService( + ':sdks:java:extensions:sql:expansion-service:shadowJar')) Review comment: I've been thinking on how to best test these things, and possibly it could make sense to have a mocking infrastructure (or even pipeline options) where one could provide a mapping from these hard-coded targets to explicit paths to jars and/or URLs to pre-started services. (Likely in a follow-up PR.) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 410536) Time Spent: 3h 50m (was: 3h 40m) > Add Python SqlTransform example script > -------------------------------------- > > Key: BEAM-8603 > URL: https://issues.apache.org/jira/browse/BEAM-8603 > Project: Beam > Issue Type: Improvement > Components: sdk-py-core > Reporter: Brian Hulette > Assignee: Brian Hulette > Priority: Major > Time Spent: 3h 50m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)