""" Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from snowflake import connector import sqlite3 class connecter(object): def __init__(self): self.cobject = [] def connect(self, sfparams): user = sfparams[0].rstrip() password = sfparams[1][2] account = sfparams[1][3] warehouse = sfparams[1][4] database = sfparams[1][0] schema = sfparams[2] try: conn = connector.connect( user=user, password=password, account=account, warehouse=warehouse, database=database, schema=schema, ) conn._paramstyle = "qmark" except Exception as e: print(f"Unable to connect to schema: {database}.{schema}:") print(str(e)) else: print(f"Connected to {database}.{schema} in warehouse: {warehouse}.") return (database, schema, conn) def open_sqlite(self, dbfile): utilconn = sqlite3.connect(dbfile) utilcur = utilconn.cursor() return (utilconn, utilcur) def __del__(self): pass