MCPcopy Create free account
hub / github.com/Mause/duckdb_engine / execute

Method execute

duckdb_engine/__init__.py:130–160  ·  view source on GitHub ↗
(
        self,
        statement: str,
        parameters: Optional[Tuple] = None,
        context: Optional[Any] = None,
    )

Source from the content-addressed store, hash-verified

128 self.__c.executemany(statement, list(parameters) if parameters else [])
129
130 def execute(
131 self,
132 statement: str,
133 parameters: Optional[Tuple] = None,
134 context: Optional[Any] = None,
135 ) -> None:
136 try:
137 if statement.lower() == "commit": # this is largely for ipython-sql
138 self.__c.commit()
139 elif statement.lower() in (
140 "register",
141 "register(?, ?)",
142 "register($1, $2)",
143 ):
144 assert parameters and len(parameters) == 2, parameters
145 view_name, df = parameters
146 self.__c.register(view_name, df)
147 elif parameters is None:
148 self.__c.execute(statement)
149 else:
150 self.__c.execute(statement, parameters)
151 except RuntimeError as e:
152 if e.args[0].startswith("Not implemented Error"):
153 raise NotImplementedError(*e.args) from e
154 elif (
155 e.args[0]
156 == "TransactionContext Error: cannot commit - no transaction is active"
157 ):
158 return
159 else:
160 raise e
161
162 @property
163 def connection(self) -> "Connection":

Callers 15

get_core_configFunction · 0.80
apply_configFunction · 0.80
__init__Method · 0.80
connectMethod · 0.80
get_view_namesMethod · 0.80
get_schema_namesMethod · 0.80
get_table_namesMethod · 0.80
get_table_oidMethod · 0.80
get_multi_columnsMethod · 0.80
has_comment_supportFunction · 0.80
test_get_schema_namesFunction · 0.80
test_get_table_namesFunction · 0.80

Calls

no outgoing calls

Tested by 15

test_get_schema_namesFunction · 0.64
test_get_table_namesFunction · 0.64
test_get_viewsFunction · 0.64
test_preload_extensionFunction · 0.64
inspectorFunction · 0.64
test_reflectFunction · 0.64
test_commitFunction · 0.64
test_table_reflectFunction · 0.64
test_fetch_df_chunksFunction · 0.64
test_fetchmanyFunction · 0.64
test_configFunction · 0.64
test_url_configFunction · 0.64