database-sql-local 0.0.1b3455__py3-none-any.whl

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.
File without changes
@@ -0,0 +1,26 @@
1
+ """SQL conditions over a range of dates, the same on MySQL and PostgreSQL.
2
+
3
+ A function here returns a WHERE condition and its parameters, ready for
4
+ GenericCRUD's select_multi_dict_by_where(where=..., params=...) or for any
5
+ DB-API cursor.execute(). It uses only ANSI SQL - comparisons and COALESCE - and
6
+ %s placeholders, the parameter style of both mysql-connector and psycopg2.
7
+
8
+ Column names are written into the SQL text, so pass the table's own column
9
+ constants, never a value that came from a user.
10
+ """
11
+ from python_sdk_remote.datetime_range import DatetimeRange
12
+
13
+
14
+ def get_datetime_range_overlap_where_and_params(*, datetime_range: DatetimeRange,
15
+ start_datetime_column_name: str,
16
+ end_datetime_column_name: str) -> tuple[str, tuple]:
17
+ """The rows whose time overlaps the range.
18
+
19
+ A row overlaps when it starts no later than the range ends and ends no
20
+ earlier than the range starts. A row whose end is NULL is taken to end when
21
+ it starts, so a range that contains its start finds it.
22
+ """
23
+ where = (f"{start_datetime_column_name} <= %s AND "
24
+ f"COALESCE({end_datetime_column_name}, {start_datetime_column_name}) >= %s")
25
+ params = (datetime_range.end_datetime, datetime_range.start_datetime)
26
+ return where, params
File without changes
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: database-sql-local
3
+ Version: 0.0.1b3455
4
+ Summary: PyPI database-sql-local Python Package owned by Circlez.ai
5
+ Home-page: https://github.com/circles-zone/database-sql-local-python-package
6
+ Author: Circles
7
+ Author-email: info@circlez.ai
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: python-sdk-remote>=0.0.158
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: classifier
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: home-page
18
+ Dynamic: requires-dist
19
+ Dynamic: summary
20
+
21
+ PyPI database-sql-local Python Package owned by Circlez.ai
@@ -0,0 +1,7 @@
1
+ database_sql_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ database_sql_local/datetime_range_sql.py,sha256=-Pt7Khgui9EnYbgnXFbxpkXDu-r9jxKaGsAqisjzpVw,1347
3
+ database_sql_local/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ database_sql_local-0.0.1b3455.dist-info/METADATA,sha256=nUgKeoFqDmwAZXosfCLKmF-9u5JkhYyLOD_jvRzJXd4,667
5
+ database_sql_local-0.0.1b3455.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
6
+ database_sql_local-0.0.1b3455.dist-info/top_level.txt,sha256=zBKTmna_c-bu-u0MnjM6XS3pnpcj9WfkBfLWfHviZis,19
7
+ database_sql_local-0.0.1b3455.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ database_sql_local