Sample
sqlalchemy 2.0.51: exc.ObjectNotExecutableError
Verified sample for pypi sqlalchemy 2.0.51: exc.ObjectNotExecutableError. The contract ran on python 3.12 · linux debian/x64 · docker and passed.
sha256:92680a5c95b189a07ae79201f3c9fd65d1cb3d6240345053ac8e79c5cbda430a
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
python linux 24 · ubuntu · glibc 2.39 x64 python python pip
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| python 3.12 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-slim@sha256:09f7da3bc104… |
2026-09-05 |
Case
HOW- Goal
- verify sqlalchemy.exc.ObjectNotExecutableError in pkg:pypi/sqlalchemy@2.0.51
- Packages
- Symbols
-
- sqlalchemy.exc.ObjectNotExecutableError
- Environment
- python
- Created
- 2026-09-05T23:38:29Z
Contract
- ObjectNotExecutableError inherits from ArgumentError and SQLAlchemyError and preserves the offending target object.
- ObjectNotExecutableError supports serialization and deserialization via standard pickle roundtrip.
- Connection.execute raises ObjectNotExecutableError when passed a raw SQL string or non-executable object.
- Connection.execute raises ObjectNotExecutableError when passed SQL schema elements like Table or Column that do not support direct execution.
- Connection.scalar and Connection.scalars raise ObjectNotExecutableError when passed a non-executable object.
- Wrapping raw SQL strings with sqlalchemy.text produces an executable construct that executes successfully.
Files
- NOTES.md
- PROMPT.md
- csx.json
- requirements.txt
- spec.json
- test/contract.py
Source
# sqlalchemy ObjectNotExecutableError API
This sample pins `sqlalchemy` 2.0.51 and verifies `sqlalchemy.exc.ObjectNotExecutableError`.
In SQLAlchemy 2.0, direct execution of raw SQL strings and non-executable objects is prohibited; executable constructs such as `sqlalchemy.text()` must be used.
The contract verifies:
- `ObjectNotExecutableError` inherits from `ArgumentError` and `SQLAlchemyError` and preserves the offending target object.
- `ObjectNotExecutableError` supports serialization and deserialization via standard pickle roundtrip.
- `Connection.execute` raises `ObjectNotExecutableError` when passed a raw SQL string or non-executable object.
- `Connection.execute` raises `ObjectNotExecutableError` when passed SQL schema elements like `Table` or `Column` that do not support direct execution.
- `Connection.scalar` and `Connection.scalars` raise `ObjectNotExecutableError` when passed a non-executable object.
- Wrapping raw SQL strings with `sqlalchemy.text()` produces an executable construct that executes successfully.
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify sqlalchemy.exc.ObjectNotExecutableError in pkg:pypi/sqlalchemy@2.0.51
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/sqlalchemy@2.0.51
Demonstrate these symbols/APIs:
- sqlalchemy.exc.ObjectNotExecutableError
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:d7a3a14145d3ee96a87dc92ea2b801e9cac4dc87b965be86d8b3d8541875ce48","contract":["ObjectNotExecutableError inherits from ArgumentError and SQLAlchemyError and preserves the offending target object.","ObjectNotExecutableError supports serialization and deserialization via standard pickle roundtrip.","Connection.execute raises ObjectNotExecutableError when passed a raw SQL string or non-executable object.","Connection.execute raises ObjectNotExecutableError when passed SQL schema elements like Table or Column that do not support direct execution.","Connection.scalar and Connection.scalars raise ObjectNotExecutableError when passed a non-executable object.","Wrapping raw SQL strings with sqlalchemy.text produces an executable construct that executes successfully."],"goal":"verify sqlalchemy.exc.ObjectNotExecutableError in pkg:pypi/sqlalchemy@2.0.51","kind":"HOW","packages":["pkg:pypi/sqlalchemy@2.0.51"],"schemaVersion":1,"symbols":["sqlalchemy.exc.ObjectNotExecutableError"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","executionContext":"python","language":"python","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","runtime":"python","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/sqlalchemy@2.0.51"],"schemaVersion":1,"subject":"pkg:pypi/sqlalchemy@2.0.51","symbols":["sqlalchemy.exc.ObjectNotExecutableError"],"verifierAdapter":"python@1"}
sqlalchemy==2.0.51
{
"schemaVersion": 1,
"goal": "verify sqlalchemy.exc.ObjectNotExecutableError in pkg:pypi/sqlalchemy@2.0.51",
"kind": "HOW",
"packages": [
"pkg:pypi/sqlalchemy@2.0.51"
],
"symbols": [
"sqlalchemy.exc.ObjectNotExecutableError"
]
}
import pickle
import sqlalchemy
from sqlalchemy import create_engine, text, Table, Column, Integer, MetaData
from sqlalchemy.exc import ObjectNotExecutableError, ArgumentError, SQLAlchemyError
# 1. Class hierarchy and direct instantiation
err = ObjectNotExecutableError("SELECT 1")
assert isinstance(err, ArgumentError), f"Expected ArgumentError, got {type(err)}"
assert isinstance(err, SQLAlchemyError), f"Expected SQLAlchemyError, got {type(err)}"
assert err.target == "SELECT 1"
assert "Not an executable object: 'SELECT 1'" in str(err)
# 2. Pickle / unpickle roundtrip support via __reduce__
dumped = pickle.dumps(err)
loaded = pickle.loads(dumped)
assert isinstance(loaded, ObjectNotExecutableError)
assert loaded.target == "SELECT 1"
assert str(loaded) == str(err)
# 3. Connection.execute raises ObjectNotExecutableError for non-executable targets
engine = create_engine("sqlite:///:memory:")
with engine.connect() as conn:
# Raw SQL string
try:
conn.execute("SELECT 1")
raise AssertionError("Expected ObjectNotExecutableError for raw string in conn.execute")
except ObjectNotExecutableError as e:
assert e.target == "SELECT 1"
assert "Not an executable object" in str(e)
# Non-clauseelement types (int, list, dict)
for invalid_target in [123, [1, 2], {"key": "value"}]:
try:
conn.execute(invalid_target)
raise AssertionError(f"Expected ObjectNotExecutableError for {invalid_target}")
except ObjectNotExecutableError as e:
assert e.target == invalid_target
# ClauseElements that do not support direct execution (Table, Column)
metadata = MetaData()
test_table = Table("items", metadata, Column("id", Integer, primary_key=True))
try:
conn.execute(test_table)
raise AssertionError("Expected ObjectNotExecutableError for Table object")
except ObjectNotExecutableError as e:
assert e.target is test_table
try:
conn.execute(test_table.c.id)
raise AssertionError("Expected ObjectNotExecutableError for Column object")
except ObjectNotExecutableError as e:
assert e.target is test_table.c.id
# 4. Connection.scalar and Connection.scalars raise ObjectNotExecutableError
try:
conn.scalar("SELECT 1")
raise AssertionError("Expected ObjectNotExecutableError for raw string in conn.scalar")
except ObjectNotExecutableError as e:
assert e.target == "SELECT 1"
try:
conn.scalars("SELECT 1")
raise AssertionError("Expected ObjectNotExecutableError for raw string in conn.scalars")
except ObjectNotExecutableError as e:
assert e.target == "SELECT 1"
# 5. Wrapping raw SQL with text() creates an Executable and succeeds
res_exec = conn.execute(text("SELECT 1")).scalar()
assert res_exec == 1
res_scalar = conn.scalar(text("SELECT 2"))
assert res_scalar == 2
res_scalars = conn.scalars(text("SELECT 3")).one()
assert res_scalars == 3
print("CONTRACT PASS: sqlalchemy.exc.ObjectNotExecutableError verified offline")
Origin Seeder
anonymous