Comments (3)
Hey, thanks for reporting this.
Can you provide the traceback of what went wrong?
from sqladmin.
Basically, the UUID
type doesn't implement python_type
method defined in the sqla docs.
Here's an example:
from sqlalchemy import Column, String, text
from sqlalchemy.dialects.postgresql import UUID
from .db import Base
class User(Base):
__tablename__ = "users"
id = Column(UUID, primary_key=True, server_default=text("public.uuid_generate_v4()"))
name = Column(String, index=True, nullable=True)
Here's the traceback:
500 Server Error
NotImplementedError:
Traceback
File .venv/lib/python3.10/site-packages/sqlalchemy/sql/type_api.py, line 518, in python_type‒
515. in practice.
516.
517. """
518. raise NotImplementedError()
519.
520. def with_variant(self, type_, dialect_name):
521. r"""Produce a new type object that will utilize the given
File .venv/lib/python3.10/site-packages/sqladmin/models.py, line 373, in get_model_by_pk‒
370. return pagination
371.
372. async def get_model_by_pk(self, value: Any) -> Any:
373. stmt = select(self.model).where(self.pk_column == self.pk_column.type.python_type(value))
374.
375. for _, relation in self._details_relations:
376. stmt = stmt.options(selectinload(relation.key))
File .venv/lib/python3.10/site-packages/sqladmin/application.py, line 249, in details‒
246.
247. model_admin = self._find_model_admin(request.path_params["identity"])
248.
249. model = await model_admin.get_model_by_pk(request.path_params["pk"])
250. if not model:
251. raise HTTPException(status_code=404)
252.
File .venv/lib/python3.10/site-packages/starlette/routing.py, line 61, in app‒
58. async def app(scope: Scope, receive: Receive, send: Send) -> None:
59. request = Request(scope, receive=receive, send=send)
60. if is_coroutine:
61. response = await func(request)
62. else:
63. response = await run_in_threadpool(func, request)
64. await response(scope, receive, send)
File .venv/lib/python3.10/site-packages/starlette/routing.py, line 259, in handle‒
256. response = PlainTextResponse("Method Not Allowed", status_code=405)
257. await response(scope, receive, send)
258. else:
259. await self.app(scope, receive, send)
260.
261. def __eq__(self, other: typing.Any) -> bool:
262. return (
File .venv/lib/python3.10/site-packages/starlette/routing.py, line 656, in __call__‒
653. match, child_scope = route.matches(scope)
654. if match == Match.FULL:
655. scope.update(child_scope)
656. await route.handle(scope, receive, send)
657. return
658. elif match == Match.PARTIAL and partial is None:
659. partial = route
File .venv/lib/python3.10/site-packages/starlette/exceptions.py, line 71, in __call__‒
68. await send(message)
69.
70. try:
71. await self.app(scope, receive, sender)
72. except Exception as exc:
73. handler = None
74.
File .venv/lib/python3.10/site-packages/starlette/exceptions.py, line 82, in __call__‒
79. handler = self._lookup_exception_handler(exc)
80.
81. if handler is None:
82. raise exc
83.
84. if response_started:
85. msg = "Caught handled exception, but response already started."
File .venv/lib/python3.10/site-packages/starlette/middleware/errors.py, line 159, in __call__‒
156. await send(message)
157.
158. try:
159. await self.app(scope, receive, _send)
160. except Exception as exc:
161. if not response_started:
162. request = Request(scope)
from sqladmin.
I've tried to get column type with column.type.impl.python_type
or column.type.python_type
and neither work for UUID. So what you suggested seems reasonable.
from sqladmin.
Related Issues (20)
- Object identifier values function not parsing correctly path parameters when a field is False
- form_type_formatters
- Changing color theme HOT 1
- Missing column_editable_list feature currently present in Flask-Admin HOT 1
- on_form_prefill functionality HOT 3
- Incorrect URLs with multiple views on the same model HOT 3
- Allow custom save calls
- Document `column_default_sort` requires strings HOT 3
- Group By Elements in the Menu HOT 3
- There is not any pypi matched with sqladmin[full] HOT 3
- exception handler
- Add messages support
- Add file downloading
- Details page gets extremely slow with many and large relationships
- Menu items within categories are always visible HOT 6
- Admin panel logging
- Use relative URLs instead of absolute URLs HOT 3
- Support the Aiohttp framework HOT 2
- After deleting objects, page size is not maintained
- Hashing strategy for the fields such as password in the creation of a new row HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqladmin.