Git Product home page Git Product logo

fastapi-listing's People

Contributors

danielhasan1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fastapi-listing's Issues

make dao middleware optional

DAO middelware should be optional. allow users to pass db sessions/connections in more than one manner.
This will help:

  • users to allow using their existing architecture of managing db connections.
  • allow users to manage connection lifecycle more independently
  • in managing connections who are running orm other than sqlalchemy
  • reduce an external dependency to configure a project

Metrics that matters

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:

  • in development phase of a listing api
  • in maintenance phase of a listing api
    Speaking in terms of this package as everything is broken down into components we can decide to log time component wise.

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)

Put a limit on remote client page size request for performance

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.

pydantic custom fields causes an error when passed to core class FastapiListing

"""
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))

issue with allow_count_query_by_paginator flag in meta info

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.