danielhasan1 / fastapi-listing Goto Github PK
View Code? Open in Web Editor NEWAdvanced items listing library that gives you freedom to design complex listing REST APIs that can be read by human.
License: MIT License
Advanced items listing library that gives you freedom to design complex listing REST APIs that can be read by human.
License: MIT License
DAO middelware should be optional. allow users to pass db sessions/connections in more than one manner.
This will help:
How about we add some metrics that matters?
Often people wanna know which component took most of the time when a request gets stalled or if a request is taking more time:
client request passes through all the components and we can log the difference between entry & exit time.
The major impact will come at pagination level when data actually gets allocated into the memory as the listing query hits sql server at this stage. Other than this in filters we hit sql server for validation purposes which is kinda depend on the stuff or params that we are receiving.
standard unit of time - milliseconds
A standard chart could like something like this
Request enters at: 2023-12-05 13:09:00(1234567890)(unix time)
|
|Prepare Query: 0.1 ms
|___ using xyz strategy listing query received in 0.03ms
|____ query filters applied in 0.06ms (this should expand in case of multiple filters)
|____ query sorting applied in 0.01ms (this should expand in case of multiple sort)
|Paginator: 5ms
|___ query hits sql at: 2023-12-05 13:09:01(1234567890)(unix time)
|____ sql response returned in 5ms
Request exist at: 2023-12-05 13:09:06(1234567890)(unix time)
Added limit for max page size.
remote client can request for variable page size so added an option for user to configure max allowed items per page to put a limiter to avoid performance bottlenecks.
Remote client here could be anyone like frontend or some other backend server.
users will be able to use any ORM.
generate filter documentation from filter doc string.
"""
UserDropdown is a pydantic class containing a custom field. when passed like below it doesn't work
The code ends up with a TypeError: attribute name must be string, not 'DeclarativeMeta'
"""
resp = FastapiListing(self.request, self.dao, UserDropdownDetails, custom_fields=True).get_response(
self.MetaInfo(self))
when allow_count_query_by_paginator=False
paginator throws an error
pydantic.error_wrappers.ValidationError: 1 validation error for ListingPageWithoutCount[EmployeeListDetails]
response -> hasNext
none is not an allowed value (type=type_error.none.not_allowed)
__fields__
.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.