Skip to content

Commit 9b87157

Browse files
authored
Add files via upload
1 parent 6567045 commit 9b87157

File tree

1 file changed

+38
-0
lines changed
  • samples/features/machine-learning-services/python/getting-started/bike-sharing prediction

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from revoscalepy.computecontext.RxComputeContext import RxComputeContext
2+
from revoscalepy.computecontext.RxInSqlServer import RxInSqlServer
3+
from revoscalepy.computecontext.RxInSqlServer import RxSqlServerData
4+
from revoscalepy.etl.RxImport import rx_import_datasource
5+
6+
7+
class DataSource():
8+
9+
def __init__(self, connectionstring):
10+
11+
"""Data source remote compute context
12+
13+
14+
Args:
15+
connectionstring: connection string to the SQL server.
16+
17+
18+
"""
19+
self.__connectionstring = connectionstring
20+
21+
22+
23+
def loaddata(self):
24+
dataSource = RxSqlServerData(sqlQuery = "select * from dbo.trainingdata", verbose=True, reportProgress =True,
25+
connectionString = self.__connectionstring)
26+
27+
self.__computeContext = RxInSqlServer(connectionString = self.__connectionstring, autoCleanup = True)
28+
data = rx_import_datasource(dataSource)
29+
30+
return data
31+
32+
def getcomputecontext(self):
33+
34+
if self.__computeContext is None:
35+
raise RuntimeError("Data must be loaded before requesting computecontext!")
36+
37+
return self.__computeContext
38+

0 commit comments

Comments
 (0)