【问题标题】:Can't use GQL on Google App Launcher无法在 Google 应用启动器上使用 GQL
【发布时间】:2015-07-06 22:38:43
【问题描述】:

我正在为 google 应用程序引擎开发一个应用程序,但在我的应用程序引擎启动器上使用 GQL 访问数据存储时遇到了一些困难。我正在使用 PHP-GDS 库来访问数据存储区https://github.com/tomwalder/php-gds

只有在我使用 Google App Engine Launcher 时才会出现这种情况。部署应用程序后,一切都按预期工作。

调用堆栈

Uncaught exception 'google\appengine\runtime\ApplicationError'

Array
(
    [type] => 0
    [message] => GQL not supported.
    [file] => C:\Program Files (x86)\Google\google_appengine\php\sdk\google\appengine\runtime\RealApiProxy.php
    [line] => 53
    [backtrace] => Array
        (
            [0] => Array
                (
                    [file] => C:\Program Files (x86)\Google\google_appengine\php\sdk\google\appengine\runtime\ApiProxy.php
                    [line] => 40
                    [function] => makeSyncCall
                    [class] => google\appengine\runtime\RealApiProxy
                    [type] => ->
                    [args] => Array
                        (
                            [0] => datastore_v4
                            [1] => RunQuery
                            [2] => google\appengine\datastore\v4\RunQueryRequest Object
                                (
                                    [partition_id] => google\appengine\datastore\v4\PartitionId Object
                                        (
                                            [dataset_id] => dev~okacdn-534
                                        )

                                    [read_options] => google\appengine\datastore\v4\ReadOptions Object
                                        (
                                        )

                                    [gql_query] => google\appengine\datastore\v4\GqlQuery Object
                                        (
                                            [name_arg:google\appengine\datastore\v4\GqlQuery:private] => Array
                                                (
                                                )

                                            [number_arg:google\appengine\datastore\v4\GqlQuery:private] => Array
                                                (
                                                )

                                            [query_string] => SELECT * FROM `Book` ORDER BY __key__ ASC
                                            [allow_literal] => 1
                                        )

                                )

                            [3] => google\appengine\datastore\v4\RunQueryResponse Object
                                (
                                )

                            [4] => 60
                        )

                )

            [1] => Array
                (
                    [file] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\Libraries\GDS\Gateway\ProtoBuf.php
                    [line] => 205
                    [function] => makeSyncCall
                    [class] => google\appengine\runtime\ApiProxy
                    [type] => ::
                    [args] => Array
                        (
                            [0] => datastore_v4
                            [1] => RunQuery
                            [2] => google\appengine\datastore\v4\RunQueryRequest Object
                                (
                                    [partition_id] => google\appengine\datastore\v4\PartitionId Object
                                        (
                                            [dataset_id] => dev~okacdn-534
                                        )

                                    [read_options] => google\appengine\datastore\v4\ReadOptions Object
                                        (
                                        )

                                    [gql_query] => google\appengine\datastore\v4\GqlQuery Object
                                        (
                                            [name_arg:google\appengine\datastore\v4\GqlQuery:private] => Array
                                                (
                                                )

                                            [number_arg:google\appengine\datastore\v4\GqlQuery:private] => Array
                                                (
                                                )

                                            [query_string] => SELECT * FROM `Book` ORDER BY __key__ ASC
                                            [allow_literal] => 1
                                        )

                                )

                            [3] => google\appengine\datastore\v4\RunQueryResponse Object
                                (
                                )

                            [4] => 60
                        )

                )

            [2] => Array
                (
                    [file] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\Libraries\GDS\Gateway\ProtoBuf.php
                    [line] => 280
                    [function] => execute
                    [class] => GDS\Gateway\ProtoBuf
                    [type] => ->
                    [args] => Array
                        (
                            [0] => RunQuery
                            [1] => google\appengine\datastore\v4\RunQueryRequest Object
                                (
                                    [partition_id] => google\appengine\datastore\v4\PartitionId Object
                                        (
                                            [dataset_id] => dev~okacdn-534
                                        )

                                    [read_options] => google\appengine\datastore\v4\ReadOptions Object
                                        (
                                        )

                                    [gql_query] => google\appengine\datastore\v4\GqlQuery Object
                                        (
                                            [name_arg:google\appengine\datastore\v4\GqlQuery:private] => Array
                                                (
                                                )

                                            [number_arg:google\appengine\datastore\v4\GqlQuery:private] => Array
                                                (
                                                )

                                            [query_string] => SELECT * FROM `Book` ORDER BY __key__ ASC
                                            [allow_literal] => 1
                                        )

                                )

                            [2] => google\appengine\datastore\v4\RunQueryResponse Object
                                (
                                )

                        )

                )

            [3] => Array
                (
                    [file] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\Libraries\GDS\Store.php
                    [line] => 256
                    [function] => gql
                    [class] => GDS\Gateway\ProtoBuf
                    [type] => ->
                    [args] => Array
                        (
                            [0] => SELECT * FROM `Book` ORDER BY __key__ ASC
                            [1] => 
                        )

                )

            [4] => Array
                (
                    [file] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\App\Http\Controller\Sandbox.php
                    [line] => 30
                    [function] => fetchAll
                    [class] => GDS\Store
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [5] => Array
                (
                    [function] => Execute
                    [class] => App\Http\Controller\Sandbox
                    [type] => ::
                    [args] => Array
                        (
                        )

                )

            [6] => Array
                (
                    [file] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\Libraries\Oka\Web.php
                    [line] => 148
                    [function] => call_user_func_array
                    [args] => Array
                        (
                            [0] => Array
                                (
                                    [0] => \App\Http\Controller\Sandbox
                                    [1] => Execute
                                )

                            [1] => Array
                                (
                                )

                        )

                )

            [7] => Array
                (
                    [file] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\Libraries\Oka\Web.php
                    [line] => 93
                    [function] => Execute
                    [class] => Oka\Web
                    [type] => ::
                    [args] => Array
                        (
                        )

                )

            [8] => Array
                (
                    [file] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\Public\index.php
                    [line] => 30
                    [function] => Initialize
                    [class] => Oka\Web
                    [type] => ::
                    [args] => Array
                        (
                        )

                )

            [9] => Array
                (
                    [file] => C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php
                    [line] => 147
                    [args] => Array
                        (
                            [0] => C:\Users\Ole\Google Drive\Workspace\OkaCdn\Public\index.php
                        )

                    [function] => require
                )

        )

)

异常是从一些python文件中调用的

C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\cloud_datastore_validator.py:
  985  
  986  
  987:     _assert_condition(not req.HasField('gql_query'), 'GQL not supported.')
  988      _assert_initialized(req)
  989      self.__entity_validator.validate_partition_id(READ,

C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_stub_util.py:
 3861  
 3862      datastore_pbs.check_conversion(not v1_req.HasField('gql_query'),
 3863:                                    'GQL not supported')
 3864      v3_query = datastore_pb.Query()
 3865      self._query_converter.v1_to_v3_query(v1_req.partition_id, v1_req.query,
 ....
 4212  
 4213      datastore_pbs.check_conversion(not v4_req.has_gql_query(),
 4214:                                    'GQL not supported')
 4215      v3_query = datastore_pb.Query()
 4216      self._query_converter.v4_to_v3_query(v4_req.partition_id(), v4_req.query(),

C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_v4_validator.py:
 1063  
 1064  
 1065:     _assert_condition(not req.has_gql_query(), 'GQL not supported.')
 1066      _assert_initialized(req)
 1067      self.validate_read_options(req.read_options())

4 matches across 3 files

是否有人会在我的 App Engine Launcher 上不支持 GQL?

【问题讨论】:

    标签: google-app-engine google-cloud-datastore


    【解决方案1】:

    本地开发服务器目前不支持 GQL - 只有实时数据存储环境。这是 Google SDK 的限制。

    我正在考虑在 php-gds 库中添加一个基本的 GQL 解析器。请随时在此处注明您对这个想法的支持(或不支持):

    https://github.com/tomwalder/php-gds/issues/44

    我想我也在这里更新了你的问题:

    https://github.com/tomwalder/php-gds/issues/45

    【讨论】:

    • 这不是我的问题,但谢谢!我还在问题 #44 下发表了评论
    • 所以,对于任何可能感兴趣的人,我现在已经以内置解析器的形式向 php-gds 库添加了基本的 GQL 支持。这意味着您可以在本地开发环境中运行基本 GQL 查询。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-31
    • 1970-01-01
    • 1970-01-01
    • 2017-05-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多