Sfoglia il codice sorgente

bug fix: filereader

Steve Nyemba 4 anni fa
parent
commit
835e1253a5
2 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. 2 2
      setup.py
  2. 4 1
      transport/disk.py

+ 2 - 2
setup.py

@@ -8,12 +8,12 @@ def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read() 
 args    = {
     "name":"data-transport",
-    "version":"1.3.8.8",
+    "version":"1.3.9.0",
     "author":"The Phi Technology LLC","author_email":"info@the-phi.com",
     "license":"MIT",
     "packages":["transport"]}
 args["keywords"]=['mongodb','couchdb','rabbitmq','file','read','write','s3','sqlite']
-args["install_requires"] = ['pymongo','numpy','cloudant','pika','nzpy','boto3','boto','pyarrow','google-cloud-bigquery','google-cloud-bigquery-storage','flask-session','smart_open','botocore','psycopg2-binary','mysql-connector-python']
+args["install_requires"] = ['pymongo','pandas','numpy','cloudant','pika','nzpy','boto3','boto','pyarrow','google-cloud-bigquery','google-cloud-bigquery-storage','flask-session','smart_open','botocore','psycopg2-binary','mysql-connector-python']
 args["url"] =   "https://healthcareio.the-phi.com/git/code/transport.git"
 args['scripts'] = ['bin/transport']
 if sys.version_info[0] == 2 :

+ 4 - 1
transport/disk.py

@@ -26,10 +26,13 @@ class DiskReader(Reader) :
 	def isready(self):
 		return os.path.exists(self.path) 
 	def read(self,**args):
+		return pd.read_csv(self.path,delimiter=self.delimiter)
+	def stream(self,**args):
 		"""
 		This function reads the rows from a designated location on disk
 		@param	size	number of rows to be read, -1 suggests all rows
 		"""
+		
 		size = -1 if 'size' not in args else int(args['size'])
 		f = open(self.path,'rU') 
 		i = 1
@@ -39,7 +42,7 @@ class DiskReader(Reader) :
 			if size == i:
 				break
 			if self.delimiter :
-				yield row.split(self.char)
+				yield row.split(self.delimiter)
 			yield row
 		f.close()
 class DiskWriter(Writer):