sqlalchemy experiment wip.

This commit is contained in:
renaud 2024-05-22 15:53:45 -07:00
parent c7853ee3e1
commit 9e6ef9aa61
4 changed files with 15 additions and 14 deletions

View file

@ -5,9 +5,10 @@ def set(level: int) -> None:
import logging import logging
import sys import sys
logging.basicConfig(format=LOGGING_FORMAT, stream=sys.stdout)
logging.getLogger().setLevel(level)
if level == logging.DEBUG: if level == logging.DEBUG:
logging.basicConfig(level=logging.DEBUG, format=LOGGING_FORMAT, stream=sys.stdout)
logging.debug("Verbose DEBUG logging enabled") logging.debug("Verbose DEBUG logging enabled")
else: else:
logging.basicConfig(level=logging.INFO, format=LOGGING_FORMAT, stream=sys.stdout)
logging.info("Logging level set to INFO") logging.info("Logging level set to INFO")

View file

@ -277,6 +277,6 @@ def get_constrained_function_context_and_helper_functions(
context_len += source_len context_len += source_len
else: else:
break break
logging.debug("FINAL OPTIMIZATION CONTEXT TOKENS LENGTH:", context_len) logging.debug(f"FINAL OPTIMIZATION CONTEXT TOKENS LENGTH: {context_len}")
helper_code: str = "\n".join(context_list) helper_code: str = "\n".join(context_list)
return helper_code, helper_functions return helper_code, helper_functions

View file

@ -10,7 +10,7 @@ readme = "README.md"
python = "^3.12.1" python = "^3.12.1"
django = "^5.0" django = "^5.0"
django-ninja = "^1.1.0" django-ninja = "^1.1.0"
openai = "^1.13.3" openai = "^1.30.1"
python-dotenv = "^1.0.0" python-dotenv = "^1.0.0"
dj-database-url = "^2.1.0" dj-database-url = "^2.1.0"
psycopg2-binary = "^2.9.9" psycopg2-binary = "^2.9.9"

View file

@ -16,8 +16,8 @@
"from sqlalchemy.orm import sessionmaker\n", "from sqlalchemy.orm import sessionmaker\n",
"from sqlalchemy.orm.relationships import Relationship" "from sqlalchemy.orm.relationships import Relationship"
], ],
"outputs": [], "execution_count": 1,
"execution_count": 1 "outputs": []
}, },
{ {
"metadata": { "metadata": {
@ -52,8 +52,8 @@
" author: Relationship[Author] = relationship(\"Author\", backref=\"books\")\n" " author: Relationship[Author] = relationship(\"Author\", backref=\"books\")\n"
], ],
"id": "f9ddc0d6d98a89e2", "id": "f9ddc0d6d98a89e2",
"outputs": [], "execution_count": 2,
"execution_count": 2 "outputs": []
}, },
{ {
"metadata": { "metadata": {
@ -65,8 +65,8 @@
"cell_type": "code", "cell_type": "code",
"source": "engine = create_engine(POSTGRES_CONNECTION_STRING, echo=True)", "source": "engine = create_engine(POSTGRES_CONNECTION_STRING, echo=True)",
"id": "a52819969951369c", "id": "a52819969951369c",
"outputs": [], "execution_count": 3,
"execution_count": 3 "outputs": []
}, },
{ {
"metadata": { "metadata": {
@ -86,8 +86,8 @@
"#print(session.scalars(stmt).one())\n" "#print(session.scalars(stmt).one())\n"
], ],
"id": "78a6b79f917779e", "id": "78a6b79f917779e",
"outputs": [], "execution_count": 4,
"execution_count": 4 "outputs": []
}, },
{ {
"metadata": { "metadata": {
@ -99,8 +99,8 @@
"cell_type": "code", "cell_type": "code",
"source": "session.scalars(stmt).one()", "source": "session.scalars(stmt).one()",
"id": "97cfebcd26c9995f", "id": "97cfebcd26c9995f",
"outputs": [], "execution_count": 5,
"execution_count": 5 "outputs": []
} }
], ],
"metadata": { "metadata": {