Code Monkey home page Code Monkey logo

edge-lib's Introduction

Edge Libraries

These are some things I found helpful when working with EdgeDB.

Table of Contents

- edge.py
  These functions use the FastAPI jsonable_encoder to convert EdgeDB query results to types that Pydantic can convert for FastAPI returns. (Edge sets to Python lists and objects to Python dictionaries)
- edge_dataclass_to_pydantic.py
  Given a path (currently hardcoded, change it if you use this) replace the NoPydanticValidation with Pydantic BaseModel based schemas. This is probably unnecessary, but some people may find it helpful. With Pydantic v1 I had to deal with issues from this with models referred to other models that weren't yet defined. I had to call a Pydantic method to resolve this before using them.
- pyd.py
  Tangentially related, this includes a function to create a Pydantic model from a Python dictionary.
- tasks.py
  This is an Invoke make alternative with one endpoint, to show the workflow I've used for EdgeDB in the past. This runs the edgedb-py cli for code generation, copies it, runs edge_model_gen, copies the generated code to where I used it, then runs isort and black on the outputted code.
- test.py
  Invoke endpoints for running tests using EdgeDB.
- tests/functional/conftest.py and tests/functional/test_edgedb_fixture.py
  Pytest fixture and examples showing how I have tested EdgeDB queries in the past.
- depends.py
  A FastAPI dependency that sets up an EdgeDB transaction and passes it to the request.

edge-lib's People

Contributors

darinkishore avatar tomfaulkner avatar

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.