浏览代码

Merge pull request #20 from lnyemba/v2.2.0

new provider console and bug fixes with applied commands
Steve L. Nyemba 8 月之前
父节点
当前提交
aa926f77a3
共有 4 个文件被更改,包括 17 次插入4 次删除
  1. 1 1
      info/__init__.py
  2. 1 1
      transport/other/__init__.py
  3. 11 1
      transport/sql/common.py
  4. 4 1
      transport/sql/duckdb.py

+ 1 - 1
info/__init__.py

@@ -1,6 +1,6 @@
 __app_name__  = 'data-transport'
 __author__ = 'The Phi Technology'
-__version__= '2.2.4'
+__version__= '2.2.6'
 __email__  = "info@the-phi.com"
 __license__=f"""
 Copyright 2010 - 2024, Steve L. Nyemba

+ 1 - 1
transport/other/__init__.py

@@ -1 +1 @@
-from . import files, http, rabbitmq, callback, files
+from . import files, http, rabbitmq, callback, files, console

+ 11 - 1
transport/sql/common.py

@@ -3,6 +3,8 @@ This file encapsulates common operations associated with SQL databases via SQLAl
 
 """
 import sqlalchemy as sqa
+from sqlalchemy import text 
+
 import pandas as pd
 
 class Base:
@@ -56,7 +58,15 @@ class Base:
 
         @TODO: Execution of stored procedures
         """
-        return pd.read_sql(sql,self._engine) if sql.lower().startswith('select') or sql.lower().startswith('with') else None
+        if sql.lower().startswith('select') or sql.lower().startswith('with') :
+
+            return pd.read_sql(sql,self._engine) 
+        else:
+            _handler = self._engine.connect()
+            _handler.execute(text(sql))
+            _handler.commit ()
+            _handler.close()
+        return None
 
 class SQLBase(Base):
     def __init__(self,**_args):

+ 4 - 1
transport/sql/duckdb.py

@@ -5,7 +5,10 @@ from transport.sql.common import Base, BaseReader, BaseWriter
 
 class Duck :
     def __init__(self,**_args):
-        self.database = _args['database']
+        #
+        # duckdb with none as database will operate as an in-memory database
+        #
+        self.database = _args['database'] if 'database' in _args else ''
     def get_provider(self):
         return "duckdb"