flask_autocrud icon indicating copy to clipboard operation
flask_autocrud copied to clipboard

AttributeError: 'Query' object has no attribute '_join_entities'

Open MinuraPunchihewa opened this issue 2 years ago • 1 comments

Hi @cs91chris, First of all, thank you for this awesome project!

I am getting the above error, when I try to run a request against any of the model endpoints,

import os
import pyodbc
from dotenv import load_dotenv

from flask import Flask

from flask_autocrud import AutoCrud, Model
from flask_sqlalchemy import SQLAlchemy

load_dotenv()


app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = f"{os.environ.get('DB_CONN_STR')}?driver={pyodbc.drivers()[-1]}"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['AUTOCRUD_METADATA_ENABLED'] = True
app.config['AUTOCRUD_DATABASE_SCHEMA'] = os.environ.get('DB_TABLE_SCHEMA')

db = SQLAlchemy(app)

with app.app_context():
    AutoCrud(app, db)

if __name__ == '__main__':
    app.run(debug=True)

When I run a requests against the /resources endpoint I see all of the tables in my schema though.

Am I doing something wrong here?

Note: My SQLAlchemy version is 2.0.6.

MinuraPunchihewa avatar Mar 21 '23 06:03 MinuraPunchihewa

Hi @MinuraPunchihewa, thanks and sorry for the late response. This repo is old and not maintened too, but I am sure that it is not compatible with sqlalchemy 2 for the breaking changes that ships with it.

cs91chris avatar Jul 13 '23 21:07 cs91chris