[ 
https://issues.apache.org/jira/browse/BEAM-8603?focusedWorklogId=410538&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-410538
 ]

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_r398833260
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/sql_test.py
 ##########
 @@ -0,0 +1,109 @@
+#
+# 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.
+#
+
+"""Tests for transforms that use the SQL Expansion service."""
+
+# pytype: skip-file
+
+from __future__ import absolute_import
+
+import logging
+import typing
+import unittest
+
+from nose.plugins.attrib import attr
+from past.builtins import unicode
+
+import apache_beam as beam
+from apache_beam import coders
+from apache_beam.options.pipeline_options import DebugOptions
+from apache_beam.options.pipeline_options import StandardOptions
+from apache_beam.testing.test_pipeline import TestPipeline
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
+from apache_beam.transforms.sql import SqlTransform
+from apache_beam.utils import subprocess_server
+
+SimpleRow = typing.NamedTuple(
+    "SimpleRow", [("int", int), ("str", unicode), ("flt", float)])
+coders.registry.register_coder(SimpleRow, coders.RowCoder)
+
+
+@attr('UsesSqlExpansionService')
+@unittest.skipIf(
+    TestPipeline().get_pipeline_options().view_as(StandardOptions).runner is
+    None,
+    "Must be run with a runner that supports cross-language transforms")
+class SqlTransformTest(unittest.TestCase):
+  """Tests that exercise the cross-language SqlTransform (implemented in java).
+
+  Note this test must be executed with pipeline options that run jobs on a 
local
+  job server. The easiest way to accomplish this is to run the
+  `validatesCrossLanguageRunnerPythonUsingSql` gradle target for a particular
+  job server, which will start the runner and job server for you. For example,
+  `:runners:flink:1.10:job-server:validatesCrossLanguageRunnerPythonUsingSql` 
to
+  test on Flink 1.10.
+
+  Alternatively, you may be able to iterate faster if you run the tests 
directly
+  using a runner like `FlinkRunner`, which starts its own job server, but 
you'll
+  need to spin up a local flink cluster:
+    $ pip install -e './sdks/python[gcp,test]'
+    $ python ./sdks/python/setup.py nosetests \\
+        --tests apache_beam.transforms.sql_test \\
+        --test-pipeline-options="--runner=FlinkRunner \\
+                                 --flink_version=1.10 \\
+                                 --flink_master=localhost:8081"
+  """
+  @staticmethod
+  def make_test_pipeline():
+    path_to_jar = subprocess_server.JavaJarServer.path_to_beam_jar(
+        ":sdks:java:extensions:sql:expansion-service:shadowJar")
+    test_pipeline = TestPipeline()
+    test_pipeline.get_pipeline_options().view_as(DebugOptions).experiments = [
+        'jar_packages=' + path_to_jar
 
 Review comment:
   @ihji What JIRA should we reference to obviate the need to do this?
 
----------------------------------------------------------------
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: 410538)
    Time Spent: 4h  (was: 3h 50m)

> 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: 4h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to