bug fix, added ferretdb
This commit is contained in:
parent
64f0b3ca80
commit
695c10e797
2
setup.py
2
setup.py
|
@ -8,7 +8,7 @@ def read(fname):
|
||||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||||
args = {
|
args = {
|
||||||
"name":"data-transport",
|
"name":"data-transport",
|
||||||
"version":"1.6.6",
|
"version":"1.6.8",
|
||||||
"author":"The Phi Technology LLC","author_email":"info@the-phi.com",
|
"author":"The Phi Technology LLC","author_email":"info@the-phi.com",
|
||||||
"license":"MIT",
|
"license":"MIT",
|
||||||
"packages":["transport"]}
|
"packages":["transport"]}
|
||||||
|
|
|
@ -55,6 +55,7 @@ import os
|
||||||
class providers :
|
class providers :
|
||||||
POSTGRESQL = 'postgresql'
|
POSTGRESQL = 'postgresql'
|
||||||
MONGODB = 'mongodb'
|
MONGODB = 'mongodb'
|
||||||
|
|
||||||
BIGQUERY ='bigquery'
|
BIGQUERY ='bigquery'
|
||||||
FILE = 'file'
|
FILE = 'file'
|
||||||
ETL = 'etl'
|
ETL = 'etl'
|
||||||
|
@ -72,8 +73,10 @@ class providers :
|
||||||
# synonyms of the above
|
# synonyms of the above
|
||||||
BQ = BIGQUERY
|
BQ = BIGQUERY
|
||||||
MONGO = MONGODB
|
MONGO = MONGODB
|
||||||
|
FERRETDB= MONGODB
|
||||||
PG = POSTGRESQL
|
PG = POSTGRESQL
|
||||||
PSQL = POSTGRESQL
|
PSQL = POSTGRESQL
|
||||||
|
PGSQL = POSTGRESQL
|
||||||
|
|
||||||
class IEncoder (json.JSONEncoder):
|
class IEncoder (json.JSONEncoder):
|
||||||
def default (self,object):
|
def default (self,object):
|
||||||
|
|
|
@ -22,6 +22,7 @@ import numpy as np
|
||||||
import json
|
import json
|
||||||
import importlib
|
import importlib
|
||||||
from multiprocessing import RLock
|
from multiprocessing import RLock
|
||||||
|
import queue
|
||||||
# import couch
|
# import couch
|
||||||
# import mongo
|
# import mongo
|
||||||
|
|
||||||
|
@ -115,6 +116,8 @@ class Console(Writer):
|
||||||
finally:
|
finally:
|
||||||
if self.lock :
|
if self.lock :
|
||||||
Console.lock.release()
|
Console.lock.release()
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@NOTE : Experimental !!
|
@NOTE : Experimental !!
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -124,7 +124,15 @@ class MongoReader(Mongo,Reader):
|
||||||
|
|
||||||
return pd.DataFrame(r)
|
return pd.DataFrame(r)
|
||||||
else:
|
else:
|
||||||
collection = self.db[self.uid]
|
if 'table' in args or 'collection' in args :
|
||||||
|
if 'table' in args:
|
||||||
|
_uid = args['table']
|
||||||
|
elif 'collection' in args :
|
||||||
|
_uid = args['collection']
|
||||||
|
else:
|
||||||
|
_uid = self.uid
|
||||||
|
|
||||||
|
collection = self.db[_uid]
|
||||||
_filter = args['filter'] if 'filter' in args else {}
|
_filter = args['filter'] if 'filter' in args else {}
|
||||||
_df = pd.DataFrame(collection.find(_filter))
|
_df = pd.DataFrame(collection.find(_filter))
|
||||||
columns = _df.columns.tolist()[1:]
|
columns = _df.columns.tolist()[1:]
|
||||||
|
@ -185,6 +193,9 @@ class MongoWriter(Mongo,Writer):
|
||||||
# self.db[self.uid].insert_many(info)
|
# self.db[self.uid].insert_many(info)
|
||||||
# else:
|
# else:
|
||||||
try:
|
try:
|
||||||
|
if 'table' in _args or 'collection' in _args :
|
||||||
|
_uid = _args['table'] if 'table' in _args else _args['collection']
|
||||||
|
else:
|
||||||
_uid = self.uid if 'doc' not in _args else _args['doc']
|
_uid = self.uid if 'doc' not in _args else _args['doc']
|
||||||
if self._lock :
|
if self._lock :
|
||||||
Mongo.lock.acquire()
|
Mongo.lock.acquire()
|
||||||
|
|
|
@ -278,7 +278,9 @@ class SQLWriter(SQLRW,Writer):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
table = _args['table'] if 'table' in _args else self.table
|
table = _args['table'] if 'table' in _args else self.table
|
||||||
|
self.schema = _args['schema'] if 'schema' in _args else self.schema
|
||||||
table = self._tablename(table)
|
table = self._tablename(table)
|
||||||
|
|
||||||
_sql = "INSERT INTO :table (:fields) VALUES (:values)".replace(":table",table) #.replace(":table",self.table).replace(":fields",_fields)
|
_sql = "INSERT INTO :table (:fields) VALUES (:values)".replace(":table",table) #.replace(":table",self.table).replace(":fields",_fields)
|
||||||
|
|
||||||
if type(info) == list :
|
if type(info) == list :
|
||||||
|
|
Loading…
Reference in New Issue