Git Product home page Git Product logo

fastapi-sqlalchemy-async's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastapi-sqlalchemy-async's Issues

problems creating alembic migrations

Hello,

What is the path for creating alembic migrations? If I do it on my host machine. First, I had to add the following lines to env.py, so alembic could find the model files:

import sys

sys.path = ['', '..'] + sys.path[1:]

Then, if i try to generate migrations on my host, i get issues that all the POSTGRES variables are missing:

alembic revision --autogenerate -m "test migration"

...
pydantic.error_wrappers.ValidationError: 8 validation errors for Settings
SERVER_NAME
  field required (type=value_error.missing)
PROJECT_NAME
  field required (type=value_error.missing)
POSTGRES_SCHEME
  field required (type=value_error.missing)
POSTGRES_SERVER
  field required (type=value_error.missing)
POSTGRES_USER
  field required (type=value_error.missing)
POSTGRES_PASSWORD
  field required (type=value_error.missing)
POSTGRES_DB
  field required (type=value_error.missing)
SQLALCHEMY_DATABASE_URI
  unsupported operand type(s) for +: 'NoneType' and 'str' (type=type_error)

If I exec in to my app container and run the migration there, I get connection issues:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
        

Can't create super users

A few endpoints rely on the current user being a super user. However, when creating a user, there's no way to specify a user as being a super user, and the DB column defaults to false.

I believe that updating UserBase in the pydantic model to include the superuser field will do it, as well as updating the DB opertions in crud_user.py.

Also, the application has Groups, but they're not actually used.

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.