pyLodStorage 0.19.3__tar.gz → 0.19.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/PKG-INFO +1 -1
- pylodstorage-0.19.4/lodstorage/__init__.py +1 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/duckdb_query.py +9 -1
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/mysql.py +17 -5
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/postgresql.py +17 -4
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/querymain.py +7 -1
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/sql.py +10 -1
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/sql_backend.py +3 -1
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/version.py +1 -1
- pylodstorage-0.19.3/lodstorage/__init__.py +0 -1
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/.github/workflows/build.yml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/.github/workflows/upload-to-pypi.yml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/.gitignore +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/.project +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/.pydevproject +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/.readthedocs.yml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/.travis.yml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/AGENTS.md +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/CITATION.cff +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/LICENSE +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/README.md +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/index.md +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/Makefile +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/doctrees/environment.pickle +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/doctrees/index.doctree +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/doctrees/lodstorage.doctree +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/doctrees/sampledata.doctree +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/doctrees/setup.doctree +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/doctrees/tests.doctree +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/.buildinfo +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/index.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/csv.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/docstring_parser.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/entity.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/jsonable.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/jsonpicklemixin.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/linkml.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/linkml_gen.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/lod.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/mwTable.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/plot.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/query.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/querymain.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/rdf.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sample.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sample2.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/schema.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sparql.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sql.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/storageconfig.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sync.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/tabulateCounter.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/trulytabular.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/uml.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/version.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/xml.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/yamlable.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/yamlablemixin.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_sources/index.rst.txt +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_sources/lodstorage.rst.txt +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_sources/sampledata.rst.txt +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_sources/setup.rst.txt +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_sources/tests.rst.txt +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/alabaster.css +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/basic.css +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/custom.css +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/doctools.js +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/documentation_options.js +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/file.png +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/language_data.js +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/minus.png +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/plus.png +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/pygments.css +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/searchtools.js +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/sphinx_highlight.js +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/genindex.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/index.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/lodstorage.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/objects.inv +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/py-modindex.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/sampledata.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/search.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/searchindex.js +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/setup.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/tests.html +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/conf.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/index.rst +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/lodstorage.rst +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/make.bat +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/sampledata.rst +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/setup.rst +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/tests.rst +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/docstring_parser.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/exception_handler.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/linkml.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/linkml_gen.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/lod.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/lod2xml.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/lod_csv.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/multilang_querymanager.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/mwTable.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/params.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/plot.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/prefix_config.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/prefixes.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/profiler.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/query.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/query_cmd.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/rate_limiter.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/rdf.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/rdf_format.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/sample2.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/schema.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/sparql.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/sqlite_api.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/storageconfig.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/sync.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/tabulateCounter.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/uml.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/lodstorage/yaml_path.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/mkdocs.yml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/pyproject.toml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/__init__.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/dblp.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/endpoints.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/endpoints_qlever.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/example.ttl +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/formats.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/got.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/prefixes.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/queries/queries_olympics.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/queries/queries_tiny_wikidatasubsets_claude4_5.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/queries/queries_tiny_wikidatasubsets_gemini3pro.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/queries/queries_tiny_wikidatasubsets_gpt5.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/queries/queries_tiny_wikidatasubsets_grok4.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/queries.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/royals.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/royals_linkml_schema.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/scholia.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/trulytabular.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/wf.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/sampledata/wikidata.yaml +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/blackisort +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/doc +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/install +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/installAndTest +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/jena +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/release +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/sparqlquery +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/test +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/scripts/vsenv +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/__init__.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/action_stats.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/basetest.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/endpoint_test.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_Plot.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_csv.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_docstring_parser.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_linkml.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_linkml_schema.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_lod.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_multilang_querymanager.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_params.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_postgresql.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_prefix_config.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_prefixes.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_queries.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_query_yaml.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_rdf.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_samples.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_sql_backend.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_sqlite3.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_sync.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_tabulate.py +0 -0
- {pylodstorage-0.19.3 → pylodstorage-0.19.4}/tests/test_yaml_path.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyLodStorage
|
|
3
|
-
Version: 0.19.
|
|
3
|
+
Version: 0.19.4
|
|
4
4
|
Summary: python List of Dict (Table) Storage library
|
|
5
5
|
Project-URL: Home, https://github.com/WolfgangFahl/pyLodStorage
|
|
6
6
|
Project-URL: Documentation, http://wiki.bitplan.com/index.php/PyLoDStorage
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.19.4"
|
|
@@ -40,13 +40,15 @@ class DuckDBQuery:
|
|
|
40
40
|
self.debug = debug
|
|
41
41
|
self.con = duckdb.connect(self.path)
|
|
42
42
|
|
|
43
|
-
def query(self, sql: str, params: Any = None) -> list[dict]:
|
|
43
|
+
def query(self, sql: str, params: Any = None, commit: bool = False) -> list[dict]:
|
|
44
44
|
"""
|
|
45
45
|
Execute an SQL query and return all results eagerly.
|
|
46
46
|
|
|
47
47
|
Args:
|
|
48
48
|
sql: the SQL query string to execute
|
|
49
49
|
params: optional positional parameters (list or tuple)
|
|
50
|
+
commit: if True, commit the connection after execution
|
|
51
|
+
(required for DDL/DML statements such as CREATE/INSERT/UPDATE)
|
|
50
52
|
|
|
51
53
|
Returns:
|
|
52
54
|
list of dicts, one per row
|
|
@@ -54,9 +56,15 @@ class DuckDBQuery:
|
|
|
54
56
|
if self.debug:
|
|
55
57
|
logging.debug(f"DuckDBQuery.query: {sql!r} params={params}")
|
|
56
58
|
rel = self.con.execute(sql, params or [])
|
|
59
|
+
if rel.description is None:
|
|
60
|
+
if commit:
|
|
61
|
+
self.con.commit()
|
|
62
|
+
return []
|
|
57
63
|
cols = [d[0] for d in rel.description]
|
|
58
64
|
rows = rel.fetchall()
|
|
59
65
|
result = [dict(zip(cols, row)) for row in rows]
|
|
66
|
+
if commit:
|
|
67
|
+
self.con.commit()
|
|
60
68
|
return result
|
|
61
69
|
|
|
62
70
|
def query_gen(self, sql: str, params: Any = None) -> Generator[dict, None, None]:
|
|
@@ -69,20 +69,28 @@ class MySqlQuery:
|
|
|
69
69
|
decoded_record[key] = value
|
|
70
70
|
return decoded_record
|
|
71
71
|
|
|
72
|
-
def execute_sql_query(
|
|
72
|
+
def execute_sql_query(
|
|
73
|
+
self, query: str, commit: bool = False
|
|
74
|
+
) -> List[Dict[str, Any]]:
|
|
73
75
|
"""
|
|
74
76
|
Executes an SQL query using the provided connection parameters.
|
|
75
77
|
|
|
76
78
|
Args:
|
|
77
79
|
query (str): The SQL query to execute.
|
|
78
|
-
|
|
80
|
+
commit (bool): if True, commit the connection before closing
|
|
81
|
+
(required for DDL/DML statements such as CREATE/INSERT/UPDATE)
|
|
79
82
|
|
|
80
83
|
Returns:
|
|
81
84
|
list: A list of dictionaries representing the query results.
|
|
82
85
|
"""
|
|
83
86
|
connection, cursor = self.get_cursor(query)
|
|
84
87
|
cursor.execute(query)
|
|
85
|
-
|
|
88
|
+
if cursor.description is None:
|
|
89
|
+
raw_lod = []
|
|
90
|
+
else:
|
|
91
|
+
raw_lod = cursor.fetchall()
|
|
92
|
+
if commit:
|
|
93
|
+
connection.commit()
|
|
86
94
|
connection.close()
|
|
87
95
|
lod = []
|
|
88
96
|
for raw_row in raw_lod:
|
|
@@ -108,18 +116,22 @@ class MySqlQuery:
|
|
|
108
116
|
cursor.close()
|
|
109
117
|
connection.close()
|
|
110
118
|
|
|
111
|
-
def query(
|
|
119
|
+
def query(
|
|
120
|
+
self, sql: str, params: Any = None, commit: bool = False
|
|
121
|
+
) -> List[Dict[str, Any]]:
|
|
112
122
|
"""
|
|
113
123
|
SQLBackend protocol alias for execute_sql_query.
|
|
114
124
|
|
|
115
125
|
Args:
|
|
116
126
|
sql: the SQL query to execute
|
|
117
127
|
params: ignored (not yet supported at the pymysql layer)
|
|
128
|
+
commit: if True, commit the connection after execution
|
|
129
|
+
(required for DDL/DML statements such as CREATE/INSERT/UPDATE)
|
|
118
130
|
|
|
119
131
|
Returns:
|
|
120
132
|
list of dicts, one per row
|
|
121
133
|
"""
|
|
122
|
-
return self.execute_sql_query(sql)
|
|
134
|
+
return self.execute_sql_query(sql, commit=commit)
|
|
123
135
|
|
|
124
136
|
def query_gen(
|
|
125
137
|
self, sql: str, params: Any = None
|
|
@@ -72,19 +72,28 @@ class PostgreSqlQuery:
|
|
|
72
72
|
decoded_record[key] = value
|
|
73
73
|
return decoded_record
|
|
74
74
|
|
|
75
|
-
def execute_sql_query(
|
|
75
|
+
def execute_sql_query(
|
|
76
|
+
self, query: str, commit: bool = False
|
|
77
|
+
) -> List[Dict[str, Any]]:
|
|
76
78
|
"""
|
|
77
79
|
Executes an SQL query using the provided connection parameters.
|
|
78
80
|
|
|
79
81
|
Args:
|
|
80
82
|
query (str): The SQL query to execute.
|
|
83
|
+
commit (bool): if True, commit the connection before closing
|
|
84
|
+
(required for DDL/DML statements such as CREATE/INSERT/UPDATE)
|
|
81
85
|
|
|
82
86
|
Returns:
|
|
83
87
|
list: A list of dictionaries representing the query results.
|
|
84
88
|
"""
|
|
85
89
|
connection, cursor = self.get_cursor(query)
|
|
86
90
|
cursor.execute(query)
|
|
87
|
-
|
|
91
|
+
if cursor.description is None:
|
|
92
|
+
raw_lod = []
|
|
93
|
+
else:
|
|
94
|
+
raw_lod = cursor.fetchall()
|
|
95
|
+
if commit:
|
|
96
|
+
connection.commit()
|
|
88
97
|
connection.close()
|
|
89
98
|
lod = []
|
|
90
99
|
for raw_row in raw_lod:
|
|
@@ -110,18 +119,22 @@ class PostgreSqlQuery:
|
|
|
110
119
|
cursor.close()
|
|
111
120
|
connection.close()
|
|
112
121
|
|
|
113
|
-
def query(
|
|
122
|
+
def query(
|
|
123
|
+
self, sql: str, params: Any = None, commit: bool = False
|
|
124
|
+
) -> List[Dict[str, Any]]:
|
|
114
125
|
"""
|
|
115
126
|
SQLBackend protocol alias for execute_sql_query.
|
|
116
127
|
|
|
117
128
|
Args:
|
|
118
129
|
sql: the SQL query to execute
|
|
119
130
|
params: ignored (not yet supported at the psycopg2 layer)
|
|
131
|
+
commit: if True, commit the connection after execution
|
|
132
|
+
(required for DDL/DML statements such as CREATE/INSERT/UPDATE)
|
|
120
133
|
|
|
121
134
|
Returns:
|
|
122
135
|
list of dicts, one per row
|
|
123
136
|
"""
|
|
124
|
-
return self.execute_sql_query(sql)
|
|
137
|
+
return self.execute_sql_query(sql, commit=commit)
|
|
125
138
|
|
|
126
139
|
def query_gen(
|
|
127
140
|
self, sql: str, params: Any = None
|
|
@@ -96,7 +96,7 @@ class QueryMain(QueryCmd):
|
|
|
96
96
|
qlod = sparql.queryAsListOfDicts(self.queryCode)
|
|
97
97
|
elif args.language == "sql":
|
|
98
98
|
backend = get_sql_backend(endpointConf, debug=args.debug)
|
|
99
|
-
qlod = backend.query(self.queryCode)
|
|
99
|
+
qlod = backend.query(self.queryCode, commit=args.commit)
|
|
100
100
|
else:
|
|
101
101
|
raise Exception(f"language {args.language} not known/supported")
|
|
102
102
|
self.format_output(qlod)
|
|
@@ -267,6 +267,12 @@ USAGE
|
|
|
267
267
|
action="store_true",
|
|
268
268
|
help="return the raw query result from the endpoint. (MIME type defined over -f or -m)",
|
|
269
269
|
)
|
|
270
|
+
parser.add_argument(
|
|
271
|
+
"--commit",
|
|
272
|
+
action="store_true",
|
|
273
|
+
help="commit the SQL transaction after execution "
|
|
274
|
+
"(required for DDL/DML statements such as CREATE/INSERT/UPDATE)",
|
|
275
|
+
)
|
|
270
276
|
parser.add_argument(
|
|
271
277
|
"-V", "--version", action="version", version=program_version_message
|
|
272
278
|
)
|
|
@@ -256,6 +256,11 @@ class SQLDB(object):
|
|
|
256
256
|
query = cur.execute(sqlQuery, params)
|
|
257
257
|
else:
|
|
258
258
|
query = cur.execute(sqlQuery)
|
|
259
|
+
# description is None for statements that do not return rows
|
|
260
|
+
# (e.g. CREATE TABLE, INSERT, UPDATE, DELETE)
|
|
261
|
+
if query.description is None:
|
|
262
|
+
cur.close()
|
|
263
|
+
return
|
|
259
264
|
colname = [d[0] for d in query.description]
|
|
260
265
|
try:
|
|
261
266
|
# loop over all rows
|
|
@@ -281,7 +286,7 @@ class SQLDB(object):
|
|
|
281
286
|
"""
|
|
282
287
|
return self.queryGen(sql, params)
|
|
283
288
|
|
|
284
|
-
def query(self, sql, params=None):
|
|
289
|
+
def query(self, sql, params=None, commit: bool = False):
|
|
285
290
|
"""
|
|
286
291
|
run the given sql query and return a list of Dicts
|
|
287
292
|
|
|
@@ -289,6 +294,8 @@ class SQLDB(object):
|
|
|
289
294
|
|
|
290
295
|
sql(string): the SQL query to be executed
|
|
291
296
|
params(tuple): the query params, if any
|
|
297
|
+
commit(bool): if True, commit the connection after execution
|
|
298
|
+
(required for DDL/DML statements such as CREATE/INSERT/UPDATE)
|
|
292
299
|
|
|
293
300
|
Returns:
|
|
294
301
|
list: a list of Dicts
|
|
@@ -296,6 +303,8 @@ class SQLDB(object):
|
|
|
296
303
|
resultList = []
|
|
297
304
|
for record in self.queryGen(sql, params):
|
|
298
305
|
resultList.append(record)
|
|
306
|
+
if commit:
|
|
307
|
+
self.c.commit()
|
|
299
308
|
return resultList
|
|
300
309
|
|
|
301
310
|
def queryAll(self, entityInfo, fixDates=True):
|
|
@@ -48,13 +48,15 @@ class SQLBackend(Protocol):
|
|
|
48
48
|
- lodstorage.postgresql.PostgreSqlQuery (PostgreSQL, optional: pip install pyLodStorage[postgresql])
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
|
-
def query(self, sql: str, params: Any = None) -> list[dict]:
|
|
51
|
+
def query(self, sql: str, params: Any = None, commit: bool = False) -> list[dict]:
|
|
52
52
|
"""
|
|
53
53
|
Execute an SQL query and return all results eagerly.
|
|
54
54
|
|
|
55
55
|
Args:
|
|
56
56
|
sql: the SQL query string to execute
|
|
57
57
|
params: optional query parameters (support depends on backend)
|
|
58
|
+
commit: if True, commit the underlying connection after execution
|
|
59
|
+
(required for DDL/DML statements such as CREATE/INSERT/UPDATE)
|
|
58
60
|
|
|
59
61
|
Returns:
|
|
60
62
|
list of dicts, one per row
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.19.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/csv.html
RENAMED
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/entity.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/linkml.html
RENAMED
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/lod.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/mwTable.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/plot.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/query.html
RENAMED
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/rdf.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sample.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sample2.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/schema.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sparql.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sql.html
RENAMED
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/sync.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/uml.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/version.html
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_modules/lodstorage/xml.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_sources/lodstorage.rst.txt
RENAMED
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_sources/sampledata.rst.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/documentation_options.js
RENAMED
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/language_data.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pylodstorage-0.19.3 → pylodstorage-0.19.4}/docs/source/_build/html/_static/sphinx_highlight.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|