python - Read table from local sql-server from an ubuntu virtual machine (virtualbox) -
i on machine windows 10 host os , have ubuntu 16.04 virtual machine installed using virtualbox. have sql server running on windows , spark-2.1.1-bin-hadoop2.7 installed on virtual machine (ubuntu).
on windows machine, can read tables server using pandas using following code:
import pandas pd import numpy np import pandas.io.sql import pyodbc # parameters server = 'localhost' db = 'claro' # create connection conn = pyodbc.connect('driver={sql server};server=' + server + ';database=' + db + ';trusted_connection=yes') # query db sql = """ select * [claro].[dbo].[tmp_frd_ctv_total] """ # excute query here df = pd.read_sql(sql, conn, chunksize=10000)
i want know if possible read same table sql server using pyspark virtual machine. if possible, have do?
thanks lot!
rodrigo.
yes, won't localhost in code, need change public ip address ( can on google search find ip or that), if connecting remote db service.
although vm runs in same computers, resources totally isolated
Comments
Post a Comment