用Oracle数据库在Django中实现分页

用Oracle数据库在Django中实现分页,django,oracle,django-rest-framework,cx-oracle,Django,Oracle,Django Rest Framework,Cx Oracle,我有一个利用Oracle作为数据库的项目,在数据库中,他们有一个视图。对于该视图,我有一个Django模型,如下所示: class MyOrmModel(models.Model): # fields class Meta: db_table = 'target_oracle_view' managed = False 相应的视图集: class LogRecordNewItemViewSet(ListModelMixin,

我有一个利用Oracle作为数据库的项目,在数据库中,他们有一个视图。对于该视图,我有一个Django模型,如下所示:

class MyOrmModel(models.Model):

    # fields

    class Meta:
        db_table = 'target_oracle_view'
        managed = False
相应的视图集:

class LogRecordNewItemViewSet(ListModelMixin,
                              GenericViewSet):
    serializer_class = # ...
    pagination_class = None


    def get_queryset(self):
        qs = MyOrmModel.objects.all()
      
        return qs
我使用
cx Oracle==7.3.0
连接到目标数据库。 现在我的目标是实现分页。但是当我这样做的时候,我遇到了一个错误

class LogRecordNewItemViewSet(ListModelMixin,
                                  GenericViewSet):
        serializer_class = # ...
        pagination_class = LimitOffsetPagination
django.db.utils.DatabaseError:ORA-00933:SQL命令不正确 结束

我遇到过这样的情况,但将Django降级到2.0.6版是行不通的。 以下是我的
requirements.txt
内容:

appdirs==1.4.3
asgiref==3.2.9
CacheControl==0.12.6
certifi==2019.11.28
chardet==3.0.4
colorama==0.4.3
contextlib2==0.6.0
cx-Oracle==7.3.0
distlib==0.3.0
distro==1.4.0
Django==2.0.6
django-cors-headers==3.4.0
djangorestframework==3.11.0
djangorestframework-camel-case==1.2.0
djangorestframework-jwt==1.11.0
html5lib==1.0.1
idna==2.8
ipaddr==2.2.0
lockfile==0.12.2
msgpack==0.6.2
packaging==20.3
pep517==0.8.2
progress==1.5
PyJWT==1.7.1
pyparsing==2.4.6
pytoml==0.1.21
pytz==2020.1
requests==2.22.0
retrying==1.3.3
sentry-sdk==0.16.2
six==1.14.0
sqlparse==0.3.1
urllib3==1.25.8
webencodings==0.5.1
psycopg2

这回答了你的问题吗?不,我的问题与Oracle的具体案例有关。不是DRFCO能否将环境变量DPI_DEBUG_LEVEL设置为值24?这将指示正在执行的SQL以及发生的任何错误。这将有助于确定问题的根源。这是否回答了您的问题?不,我的问题与Oracle的具体案例有关。不是DRFCO能否将环境变量DPI_DEBUG_LEVEL设置为值24?这将指示正在执行的SQL以及发生的任何错误。这将有助于确定问题的根源。