SubQuery开发者指南丨命令行标记

SubQuery中文站
个人专栏
热度: 38426

一文了解SubQuery开发者指南丨命令行标记

network


(此篇需横屏查看)


subql节点

●       --help


这将显示帮助选项。> subql-node --helpOptions:--help Show help [boolean]--version Show version number[boolean]-f, --subquery Local path of the subquery projec [string]--subquery-name Name of the subquery project[string]-c, --config Specify configuration file [string]--local Use local mode [boolean]--batch-size Batch size of blocks to fetch in one round [number]--timeout Timeout for indexer sandbox to execute the mappingfunctions [number]--debug Show debug information to console output. will forcefully set log level to debug [boolean][default: false]--profiler Show profiler information to console output [boolean][default: false]--network-endpoint Blockchain network endpoint to connect [string]--output-fmt Print log as json or plain text [string][choices: "json", "colored"]--log-level Specify log level to print. Ignored when --debug is used [string][choices: "fatal", "error", "warn", "info", "debug", "trace","silent"]--migrate Migrate db schema (for management tables only)[boolean][default: false]--timestamp-field Enable/disable created_at and updated_at in schema [boolean][default: true]-d, --network-dictionary Specify the dictionary api for this network [string]--proof-of-index Enable/disable proof of index [boolean][default: false] 

●       --version


显示当前版本。> subql-node --version0.19.1

●       -f, --subquery


使用此标志指向需要启动的subquery项目路径subql-node -f . // ORsubql-node --subquery .

●       --subquery-name


此标志允许您为项目提供一个名称。在创建一个新的项目时,如果用户提供项目名称,项目所在数据库的schema将以这个名称命名。subql-node -f . --subquery-name=test2

●       -c, --config


所有这些不同的配置都可以放在.yml或.json文件中,然后使用config标志进行引用。示例subquery_config.yml文件:subquery: . // Mandatory. This is the local path of the project. The period here means the current local directory.subqueryName: hello // Optional namebatchSize: 55 // Optional config将此文件放在与项目相同的目录中。然后在当前项目目录中运行:> subql-node -c ./subquery_config.yml

       --local

 这个标志主要用于调试目的,它在默认的“postgres”模式中创建默认的starter_entity表。 subql-node -f . --local

请注意,一旦使用此标志,删除它并不意味着它将指向另一个数据库。要重新指向另一个数据库,您必须创建一个新数据库,并将env设置更改为此新数据库。换句话说,“export DB_DATABASE=<new\u DB\u here>”


●       --batch-size


此标志允许您在命令行中设置batch大小。如果在配置文件中也设置了batch大小,则会优先执行此操作。 > subql-node -f . --batch-size=202021-08-09T23:24:43.775Z <fetch> INFO fetch block [6601,6620], total 20 blocks2021-08-09T23:24:45.606Z <fetch> INFO fetch block [6621,6640], total 20 blocks2021-08-09T23:24:47.415Z <fetch> INFO fetch block [6641,6660], total 20 blocks2021-08-09T23:24:49.235Z <fetch> INFO fetch block [6661,6680], total 20 blocks

●       --debug


此命令将调试信息输出到控制台输出,并强制设置日志级别为调试级别。 > subql-node -f . --debug2021-08-10T11:45:39.471Z <db> DEBUG Executing (1b0d0c23-d7c7-4adb-a703-e4e5c414e035): INSERT INTO "subquery_1"."starter_entities"("id","block_height","created_at","updated_at") VALUES ($1,$2,$3,$4) ON CONFLICT ("id") DO UPDATE SET "id"=EXCLUDED."id","block_height"=EXCLUDED."block_height","updated_at"=EXCLUDED."updated_at" RETURNING "id","block_height","created_at","updated_at";2021-08-10T11:45:39.472Z <db> DEBUG Executing (default): UPDATE "subqueries" SET "next_block_height"=$1,"updated_at"=$2 WHERE "id"=$32021-08-10T11:45:39.472Z <db> DEBUG Executing (1b0d0c23-d7c7-4adb-a703-e4e5c414e035): COMMIT;

●       --profiler

 这里显示了分析器信息。 subql-node -f . --local --profiler2021-08-10T10:57:07.234Z <profiler> INFO FetchService, fetchMeta, 3876 ms2021-08-10T10:57:08.095Z <profiler> INFO FetchService, fetchMeta, 774 ms2021-08-10T10:57:10.361Z <profiler> INFO SubstrateUtil, fetchBlocksBatches, 2265 ms2021-08-10T10:57:10.361Z <fetch> INFO fetch block [3801,3900], total 100 blocks 

●      --network-endpoint

 此标志允许用户覆盖清单文件中的网络端点配置。 subql-node -f . --network-endpoint="wss://polkadot.api.onfinality.io/public-ws"

注意,这也必须在清单文件中设置,否则将得到: ERROR Create Subquery project from given path failed! Error: failed to parse project.yaml.An instance of ProjectManifestImpl has failed the validation: - property network has failed the following constraints: isObject - property network.network has failed the following constraints: nestedValidation

●       --output-fmt

 有两种不同的终端输出格式。JSON或彩色。Colored是默认值,它包含有颜色的文本。 > subql-node -f . --output-fmt=json{"level":"info","timestamp":"2021-08-10T11:58:18.087Z","pid":24714,"hostname":"P.local","category":"fetch","message":"fetch block [10501,10600], total 100 blocks"}> subql-node -f . --output-fmt=colored2021-08-10T11:57:41.480Z <subql-node> INFO node started(node:24707)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead2021-08-10T11:57:48.981Z <fetch> INFO fetch block [10201,10300], total 100 blocks2021-08-10T11:57:51.862Z <fetch> INFO fetch block [10301,10400], total 100 blocks

●       --log-level

 有7个选项可供选择。“fatal”, “error”, “warn”, “info”, “debug”, “trace”, “silent”。下面的例子显示了silent。终端中不会打印任何内容,因此判断节点是否工作的唯一方法是查询数据库的行数(从subquery_1.starter_entities中选择count(*))或查询块的高度。 > subql-node -f . --log-level=silent(node:24686)[PINODEP007] Warning: bindings.level isdeprecated,use options.level option instead (Use `node --trace-warnings ...` to show where the warning was created)(node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead (node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead (node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead (node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead (node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead(node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead (node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead (node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead (node:24686)[DEP0152] DeprecationWarning: Custom PerformanceEntry accessors are deprecated. Please use the detail property. (node:24686)[PINODEP007] Warning: bindings.level is deprecated, use options.level option instead

●       --timestamp-field

 默认情况下为true。当设置为false时: > subql-node -f . –timestamp-field=false 创建的数据库表中将不再创建的created_at和updated_at列。

●       -d, --network-dictionary

 这允许你指定一个字典端点,它是一个免费的服务,提供和托管在:https://explorer.subquery.network/(opens的新窗口)(搜索字典),并提供一个API端点:https://api.subquery.network/sq/subquery/dictionary-polkadot

通常这将在您的清单文件中设置,但下面展示了在命令行中使用它作为参数的示例。subql-node -f . -d "https://api.subquery.network/sq/subquery/dictionary-polkadot"

点击链接阅读更多关于SubQuery Dictionary的信息:https://doc.subquery.network/tutorials_examples/dictionary.html


subql-query


●       --help

这里显示帮助选项。ns:--help       Show help [boolean]--version    Show version number [boolean]-n, --name project name [string][required]--playground enable graphql playground [boolean]--output-fmt Print log as json or plain text[string][choices: "json", "colored"][default: "colored"]--log-level  Specify log level to print.[string][choices: "fatal", "error", "warn", "info", "debug", "trace","silent"][default: "info"]--indexer Url that allow query to access indexer metadata [string]

●       --version


显示当前版本。> subql-query --version 0.7.0

●       -n, --name


该标志用于启动查询服务。如果在运行索引器时没有提供——subqueryname标志,此处的名称将引用默认的项目名称。如果设置了——subquery-name,那么这里的名称应该与设置的名称匹配。> subql-node -f . // --subquery-name not set> subql-query -n subql-helloworld --playground // the name defaults to the project directory name > subql-node -f . --subquery-name=hiworld // --subquery-name set> subql-query -n hiworld --playground // the name points to the subql-helloworld project but with the name of hiworld

●       --playground


这个标志启用了graphql playground,所以在默认情况下,应该始终包含有任何用途。

●       --output-fmt


请见链接 --https://doc.subquery.network/references/references.html#output-fmt

●       --log-level


请见链接 --https://doc.subquery.network/references/references.html#log-level

声明:本文为入驻“火星财经 专栏”作者作品,不代表火星财经官方立场。
转载请联系网页底部:内容合作栏目,邮件进行授权。授权后转载时请注明出处、作者和本文链接。未经许可擅自转载本站文章,将追究相关法律责任,侵权必究。
提示:投资有风险,入市须谨慎,本资讯不作为投资理财建议。
本内容旨在传递行业动态,不构成投资建议或承诺。