[ 
https://issues.apache.org/jira/browse/BEAM-12027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17313971#comment-17313971
 ] 

Chamikara Madhusanka Jayalath commented on BEAM-12027:
------------------------------------------------------

Currently, by default, for jdbc.py Python SDK would stage a shaded jar of 
package "schemaio-expansion-service" [1] [2]. See [3] for released version of 
the jar.

To include additional dependencies, you can start your own expansion service 
with extra dependencies you need in the CLASSPATH. All jars specified in the 
CLASSPATH should be staged by the Python SDK.

 

Rough example commands (did not run this myself):

{{java -cp "<path to schemaio-expansion-service jar>:<path  to additional jar>" 
org.apache.beam.sdk.expansion.service.ExpansionService <PORT_NUMBER>}}

 

Provide "localhost:{{<PORT_NUMBER>}}" as a the "expansion_service" parameter of 
jdbc.py.

 

[1] 
https://github.com/apache/beam/blob/2c619c81082839e054f16efee9311b9f74b6e436/sdks/python/apache_beam/io/jdbc.py#L98

[2] 
https://github.com/apache/beam/blob/master/sdks/java/extensions/schemaio-expansion-service/build.gradle

[3] 
[https://mvnrepository.com/artifact/org.apache.beam/beam-sdks-java-extensions-schemaio-expansion-service]

[4] 
[https://github.com/apache/beam/blob/2c619c81082839e054f16efee9311b9f74b6e436/sdks/python/apache_beam/io/jdbc.py#L168]

> ReadFromJDBC sql server not working
> -----------------------------------
>
>                 Key: BEAM-12027
>                 URL: https://issues.apache.org/jira/browse/BEAM-12027
>             Project: Beam
>          Issue Type: Improvement
>          Components: cross-language, io-java-jdbc
>    Affects Versions: 2.28.0
>         Environment: MacOs, apache-beam python SDK, java version "1.8.0_281"
> Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
> Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)
>            Reporter: Rebekka Moyson
>            Priority: P2
>              Labels: ClassNotFoundException, jdbc, python
>
> I want to use apache_beam.io.jdbc.ReadFromJdbc to read from a SQL server. 
> When executing locally with the python SDK and 
> driver_class_name='com.microsoft.sqlserver.jdbc.SQLServerDriver', I always 
> get the error java.lang.ClassNotFoundException: 
> com.microsoft.sqlserver.jdbc.SQLServerDriver.
> Have JDK 8 installed.
> Used beam (on dataflow runner) a lot with python and want to make use of this 
> interesting portability feature to read from jdbc with that Java Expansion 
> service.
> Not sure what is wrong and could not find a lot of documentation about this 
> jdbc io feature and how to use it as python developer. 
>  



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

Reply via email to