RETURNING or not?
- Postgres ✅
- MySQL ❌
- MariaDB ✅
| MIT License | |
| Copyright (c) 2026 mahenzon | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| class A: | |
| def __init__(self, val): | |
| self.val = val | |
| def __hash__(self): | |
| return hash(self.val) | |
| def __str__(self): | |
| return str(self.val) |
| """ | |
| Suggestion for implementing | |
| https://github.com/redis/redis-py/pull/3619 | |
| Try it here: | |
| https://mypy-play.net/?mypy=latest&python=3.14&gist=bded9af8fe83b0625ad6bf72ad4b9338&flags=strict | |
| """ | |
| from typing import Awaitable, Generic, Literal, TypeVar, overload, reveal_type | |
| OptionalDecodedString = str | None |
| -- №1 | |
| CREATE TABLE users ( | |
| id BIGINT GENERATED ALWAYS AS IDENTITY, | |
| name TEXT NOT NULL CHECK (length(name) <= 100), | |
| PRIMARY KEY (id) | |
| ) | |
| -- №2 | |
| CREATE TABLE users ( |
| import requests | |
| API_KEY = "EMPTY" | |
| # BASE_URL = "http://localhost:12345/engines/llama.cpp/v1" | |
| BASE_URL = "http://localhost:11223/v1" | |
| URL = f"{BASE_URL}/chat/completions" | |
| # MODEL = "ai/gemma3" | |
| # MODEL = "ai/gemma3n" | |
| MODEL = "gemma3:1b" |
| 3.13 |
Examples with Redis Vector and ChromaDB
Embeddings via ru-en-RoSBERTa https://huggingface.co/ai-forever/ru-en-RoSBERTa
| from functools import wraps | |
| from timeit import default_timer | |
| from typing import reveal_type, Callable, Concatenate | |
| type ExecutionTime = float | |
| def with_execution_time[**P, T]( | |
| func: Callable[P, T], | |
| ) -> Callable[P, tuple[T, ExecutionTime]]: |
| import logging | |
| # DEFAULT_LOG_FORMAT = "[%(asctime)s.%(msecs)03d] %(funcName)20s %(module)s:%(lineno)d %(levelname)-8s - %(message)s" | |
| DEFAULT_LOG_FORMAT = ( | |
| "%(funcName)10s %(module)s:%(lineno)d %(levelname)-8s - %(message)s" | |
| ) | |
| def configure_logging(level: int = logging.INFO) -> None: | |
| logging.basicConfig( |