{"id":10350,"date":"2023-06-23T01:43:43","date_gmt":"2023-06-23T08:43:43","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/python-sql-querying\/"},"modified":"2023-06-23T01:43:43","modified_gmt":"2023-06-23T08:43:43","slug":"python-sql-querying","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/","title":{"rendered":"SQL++ Querying with Python"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this tutorial, you will how to execute SQL++ (formerly N1QL) queries with positional and named parameters, with and without options, how to use scan consistencies, and the Async APIs.<\/p>\n\n\n\n<h3 id=\"h-introduction\" class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Our query service uses SQL++, which will be fairly familiar to anyone who\u2019s used any dialect of SQL. Before you get started you may wish to check out the <a href=\"hhttps:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/index.html\">N1QL intro page<\/a>, or just dive in with a query against our &#8220;travel-sample&#8221; data set. In this case, note that before you can query a bucket, you must define at least one index. You can define a <em>primary<\/em> index on a bucket. When a primary index is defined you can issue non-covered queries on the bucket as well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SQL++ queries can be executed in the following ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The Couchbase Query Workbench (in the Web Console)<\/li>\n\n\n<li>The Command-Line based Query Shell (cbq)<\/li>\n\n\n<li>Our REST API<\/li>\n\n\n<li>Any Language SDKs, including the Python SDK<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">After familiarizing yourself with the basics on how the N1QL query language works and how to query it from the UI you can use it from the Python SDK. Here\u2019s a complete example of doing a query and handling the results:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>from couchbase.cluster import Cluster\nfrom couchbase.options import ClusterOptions, QueryOptions, ClusterTimeoutOptions\nfrom couchbase.auth import PasswordAuthenticator\nfrom couchbase.exceptions import CouchbaseException\nfrom datetime import timedelta\n\npa = PasswordAuthenticator(&#039;username&#039;, &#039;password&#039;)\ncluster = Cluster(&#039;couchbase:\/\/127.0.0.1&#039;, ClusterOptions(pa))\n\n# Connect options - global timeout opts\ntimeout_opts = ClusterTimeoutOptions(kv_timeout=timedelta(seconds=30))\noptions = ClusterOptions(PasswordAuthenticator(&#039;username&#039;, &#039;password&#039;), timeout_options=timeout_opts)\n\n\ntry:\n    result = cluster.query(\n        &quot;SELECT * FROM `travel-sample`.inventory.airport LIMIT 10&quot;, QueryOptions(metrics=True))\n\n    for row in result.rows():\n        print(&quot;Found row: {}&quot;.format(row))\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s break it down. A query is always performed at the <code>Cluster<\/code> level, using the <code>query<\/code> method. It takes the statement as a required argument and then allows it to provide additional options if needed. Once a result returns you can iterate the returned rows and\/or access the <code>QueryMetaData<\/code> associated with the query.<\/p>\n\n\n\n<h3 id=\"h-queries-and-placeholders\" class=\"wp-block-heading\">Queries and Placeholders<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Placeholders allow you to specify variable constraints for an otherwise constant query. There are two variants of placeholders: positional and named parameters. Positional parameters use an ordinal placeholder for substitution and named parameters use variables. A named or positional parameter is a placeholder for a value in the WHERE, LIMIT or OFFSET clause of a query. Note that both parameters and options are optional.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are some examples of positional and named parameters with &amp; without options using the Python SDK:<\/p>\n\n\n\n<h4 id=\"h-positional-parameters-without-options\" class=\"wp-block-heading\">Positional Parameters without Options:<\/h4>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.airport WHERE city=$1&quot;,\n    &quot;San Jose&quot;)\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-positional-parameters-with-options\" class=\"wp-block-heading\">Positional Parameters with Options:<\/h4>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.airport WHERE city=$1&quot;,\n    QueryOptions(positional_parameters=[&quot;San Jose&quot;]))\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-named-parameters-without-options\" class=\"wp-block-heading\">Named Parameters without Options:<\/h4>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.airport WHERE city=$city&quot;,\n    city=&#039;San Jose&#039;)\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-named-parameters-with-options\" class=\"wp-block-heading\">Named Parameters with Options:<\/h4>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.airport WHERE city=$city&quot;,\n    QueryOptions(named_parameters={&quot;city&quot;: &quot;San Jose&quot;}))\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The complete code for this example can be found <a href=\"https:\/\/github.com\/couchbase\/docs-sdk-python\/blob\/release\/3.2\/modules\/howtos\/examples\/n1ql_ops.py\/\">here<\/a>.<\/p>\n\n\n\n<h3 id=\"h-the-query-result\" class=\"wp-block-heading\">The Query Result<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When performing a query, the response you receive is a <code>QueryResult<\/code>. If no error is returned then the request succeeded and the result provides access to both the rows returned and also associated <code>QueryMetaData<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.airline LIMIT 10&quot;)\n\n# iterate over rows\nfor row in result:\n    # each row is an instance of the query call\n    name = row[&quot;name&quot;]\n    callsign = row[&quot;callsign&quot;]\n    print(&quot;Airline name: {}, callsign: {}&quot;.format(name, callsign))\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>QueryMetaData<\/code> provides insight into some basic profiling\/timing information as well as information like the <code>ClientContextID<\/code>.<\/p>\n\n\n\n<h3 id=\"h-query-options\" class=\"wp-block-heading\">Query Options<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The query service provides an array of options to customize your query. The following is a list of them all:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>clientContextId(String)<\/code>: Sets a context ID returned by the service for debugging purposes.<\/li>\n\n\n<li><code>parameters(JsonArray)<\/code>: Allows to set positional arguments for a parameterized query.<\/li>\n\n\n<li><code>parameters(JsonObject)<\/code>: Allows to set named arguments for a parameterized query.<\/li>\n\n\n<li><code>priority(boolean)<\/code>: Assigns a different server-side priority to the query.<\/li>\n\n\n<li><code>raw(String, Object)<\/code>: Escape hatch to add arguments that are not covered by these options.<\/li>\n\n\n<li><code>readonly(boolean)<\/code>: Tells the client and server that this query is readonly.<\/li>\n\n\n<li><code>adhoc(boolean)<\/code>: If set to false will prepare the query and later execute the prepared statement.<\/li>\n\n\n<li><code>consistentWith(MutationState)<\/code>: Allows to be consistent with previously written mutations (&#8220;read your own writes&#8221;).<\/li>\n\n\n<li><code>maxParallelism(int)<\/code>: Tunes the maximum parallelism on the server.<\/li>\n\n\n<li><code>metrics(boolean)<\/code>: Enables the server to send metrics back to the client as part of the response.<\/li>\n\n\n<li><code>pipelineBatch(int)<\/code>: Sets the batch size for the query pipeline.<\/li>\n\n\n<li><code>pipelineCap(int)<\/code>: Sets the cap for the query pipeline.<\/li>\n\n\n<li><code>profile(QueryProfile)<\/code>: Allows to enable additional query profiling as part of the response.<\/li>\n\n\n<li><code>scanWait(Duration)<\/code>: Allows to specify a maximum scan wait time.<\/li>\n\n\n<li><code>scanCap(int)<\/code>: Specifies a maximum cap on the query scan size.<\/li>\n\n\n<li><code>scanConsistency(QueryScanConsistency)<\/code>: Sets a different scan consistency for this query.<\/li>\n\n\n<li><code>serializer(JsonSerializer)<\/code>: Allows to use a different serializer for the decoding of the rows.<\/li>\n\n<\/ul>\n\n\n\n<h4 id=\"h-scan-consistencies\" class=\"wp-block-heading\">Scan Consistencies<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">By default, the query engine will return whatever is currently in the index at the time of query (this mode is also called <code>QueryScanConsistency.NOT_BOUNDED<\/code>). If you need to include everything that has just been written, a different scan consistency must be chosen. If <code>QueryScanConsistency.REQUEST_PLUS<\/code> is chosen, it will likely take a bit longer to return the results but the query engine will make sure that it is as up-to-date as possible.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.airline LIMIT 10&quot;,\n    QueryOptions(scan_consistency=QueryScanConsistency.REQUEST_PLUS))\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also use <code>consistent_with=MutationState<\/code> for a more narrowed-down scan consistency. Construct the MutationState from individual \u2018MutationToken\u2019s that are returned from KV \u2018MutationResult\u2019s to make sure at least those mutations are visible. Depending on the index update rate this might provide a speedier response.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>new_hotel = {\n    &quot;callsign&quot;: None,\n    &quot;country&quot;: &quot;United States&quot;,\n    &quot;iata&quot;: &quot;TX&quot;,\n    &quot;icao&quot;: &quot;TX99&quot;,\n    &quot;id&quot;: 123456789,\n    &quot;name&quot;: &quot;Howdy Airlines&quot;,\n    &quot;type&quot;: &quot;airline&quot;\n}\n\nres = collection.upsert(\n    &quot;airline_{}&quot;.format(new_hotel[&quot;id&quot;]), new_hotel)\n\nms = MutationState(res)\n\nresult = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.airline LIMIT 10&quot;,\n    QueryOptions(consistent_with=ms))\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-client-context-id\" class=\"wp-block-heading\">Client Context ID<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The SDK will always send a client context ID with each query, even if none is provided by the user. By default a UUID will be generated that is mirrored back from the query engine and can be used for debugging purposes. A custom string can always be provided if you want to introduce application-specific semantics into it (so that for example in a network dump it shows up with a certain identifier). Whatever is chosen, we recommend making sure it is unique so different queries can be distinguished during debugging or monitoring.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.hotel LIMIT 10&quot;,\n    QueryOptions(client_context_id=&quot;user-44{}&quot;.format(uuid.uuid4())))\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-read-only\" class=\"wp-block-heading\">Read Only<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If the query is marked as readonly, both the server and the SDK can improve processing of the operation. On the client side, the SDK can be more liberal with retries because it can be sure that there are no state-mutating side-effects happening. The query engine will ensure that actually no data is mutated when parsing and planning the query.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>result = cluster.query(\n    &quot;SELECT ts.* FROM `travel-sample`.inventory.hotel LIMIT 10&quot;,\n    QueryOptions(read_only=True))\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-streaming-large-results\" class=\"wp-block-heading\">Streaming Large Results<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By default, the Python SDK will stream the result set from the server, where the client will start a persistent connection with the server and only read the header until the Rows are enumerated; then, each row or JSON object will be deserialized one at a time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This decreases pressure on Garbage Collection and helps to prevent OutOfMemory errors.<\/p>\n\n\n\n<h3 id=\"h-async-apis\" class=\"wp-block-heading\">Async APIs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to the blocking API on Cluster, the SDK provides asyncio and Twisted APIs on <code>ACluster<\/code> or <code>TxCluster<\/code> respectively. If you are in doubt of which API to use, we recommend looking at the asyncio API first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Simple queries with both asyncio and Twisted APIs look similar to the blocking one:<\/p>\n\n\n\n<h4 id=\"h-codeacouchbasecode\" class=\"wp-block-heading\"><code>ACouchbase<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>from acouchbase.cluster import Cluster, get_event_loop\nfrom couchbase.cluster import ClusterOptions, QueryOptions, ClusterTimeoutOptions\nfrom couchbase.auth import PasswordAuthenticator\nfrom couchbase.exceptions import ParsingFailedException\n\n\nasync def get_couchbase():\n    cluster = Cluster(\n        &quot;couchbase:\/\/localhost&quot;,\n        ClusterOptions(PasswordAuthenticator(&quot;Administrator&quot;, &quot;password&quot;)))\n    bucket = cluster.bucket(&quot;travel-sample&quot;)\n    await bucket.on_connect()\n    collection = bucket.default_collection()\n\n    return cluster, bucket, collection\n\n\nasync def simple_query(cluster):\n    try:\n        result = cluster.query(\n            &quot;SELECT ts.* FROM `travel-sample` ts WHERE ts.`type`=$type LIMIT 10&quot;,\n            QueryOptions(named_parameters={&quot;type&quot;: &quot;hotel&quot;}))\n        async for row in result:\n            print(&quot;Found row: {}&quot;.format(row))\n    except ParsingFailedException as ex:\n        print(ex)\n\nloop = get_event_loop()\ncluster, bucket, collection = loop.run_until_complete(get_couchbase())\nloop.run_until_complete(simple_query(cluster))\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-codetxcouchbasecode\" class=\"wp-block-heading\"><code>TxCouchbase<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>from twisted.internet import reactor\n\nfrom txcouchbase.cluster import TxCluster\nfrom couchbase.cluster import ClusterOptions, QueryOptions, ClusterTimeoutOptions\nfrom couchbase.auth import PasswordAuthenticator\n\n\ndef handle_query_results(result):\n    for r in result.rows():\n        print(&quot;query row: {}&quot;.format(r))\n    reactor.stop()\n\npa = PasswordAuthenticator(&#039;username&#039;, &#039;password&#039;)\ncluster = Cluster(&#039;couchbase:\/\/127.0.0.1&#039;, ClusterOptions(pa))\n\n# Connect options - global timeout opts\ntimeout_opts = ClusterTimeoutOptions(kv_timeout=timedelta(seconds=30))\noptions=ClusterOptions(PasswordAuthenticator(&#039;username&#039;, &#039;password&#039;), timeout_options=timeout_opts)\n\n# create a bucket object\nbucket = cluster.bucket(&quot;travel-sample&quot;)\n# create a collection object\ncb = bucket.default_collection()\n\nd = cluster.query(&quot;SELECT ts.* FROM `travel-sample` ts WHERE ts.`type`=$type LIMIT 10&quot;,\n                  QueryOptions(named_parameters={&quot;type&quot;: &quot;hotel&quot;}))\nd.addCallback(handle_query_results)\n\nreactor.run()\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-querying-at-scope-level\" class=\"wp-block-heading\">Querying at Scope Level<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It is possible to query off the <code>Scope<\/code> <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/concept-docs\/n1ql-query.html#collections-and-scopes-and-the-query-context\/\">level<\/a>, with <em>Couchbase Server release 7.0<\/em>, using the <code>scope.query()<\/code>method. It takes the statement as a required argument, and then allows additional options if needed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will how to execute SQL++ (formerly N1QL) queries with positional and named parameters, with and without options, how to use scan consistencies, and the Async APIs. Introduction Our query service uses SQL++, which will be fairly familiar to anyone who\u2019s used any dialect of SQL. Before you get started you may [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_acf":"","footnotes":""},"tutorial-languages":[606],"tutorial-tags":[574],"tutorial-technologies":[572,549,554],"tutorial-types":[555],"class_list":["post-10350","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-python","tutorial-tags-sql-n1ql","tutorial-technologies-index","tutorial-technologies-query","tutorial-technologies-server","tutorial-types-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL++ Querying with Python - Couchbase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL++ Querying with Python\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will how to execute SQL++ (formerly N1QL) queries with positional and named parameters, with and without options, how to use scan consistencies, and the Async APIs. Introduction Our query service uses SQL++, which will be fairly familiar to anyone who\u2019s used any dialect of SQL. Before you get started you may [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/\" \/>\n<meta property=\"og:site_name\" content=\"Couchbase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Couchbase\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2548\" \/>\n\t<meta property=\"og:image:height\" content=\"1171\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@couchbase\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/developers\\\/tutorials\\\/python-sql-querying\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/developers\\\/tutorials\\\/python-sql-querying\\\/\",\"name\":\"SQL++ Querying with Python - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/#website\"},\"datePublished\":\"2023-06-23T08:43:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/developers\\\/tutorials\\\/python-sql-querying\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/es\\\/developers\\\/tutorials\\\/python-sql-querying\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/developers\\\/tutorials\\\/python-sql-querying\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL++ Querying with Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"width\":1129,\"height\":1129,\"caption\":\"Couchbase\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/es\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Couchbase\\\/\",\"https:\\\/\\\/x.com\\\/couchbase\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/CouchbaseServer\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/couchbase\\\/\",\"https:\\\/\\\/github.com\\\/couchbase\\\/\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Couchbase,_Inc.\"],\"description\":\"Couchbase is a database software company headquartered in San Jose, California, providing an operational data platform for AI used by hundreds of global enterprises.\",\"legalName\":\"Couchbase, Inc.\",\"foundingDate\":\"2011-01-01\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL++ Querying with Python - Couchbase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/","og_locale":"es_MX","og_type":"article","og_title":"SQL++ Querying with Python","og_description":"In this tutorial, you will how to execute SQL++ (formerly N1QL) queries with positional and named parameters, with and without options, how to use scan consistencies, and the Async APIs. Introduction Our query service uses SQL++, which will be fairly familiar to anyone who\u2019s used any dialect of SQL. Before you get started you may [&hellip;]","og_url":"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/","og_site_name":"Couchbase","article_publisher":"https:\/\/www.facebook.com\/Couchbase\/","og_image":[{"width":2548,"height":1171,"url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@couchbase","twitter_misc":{"Est. reading time":"8 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/","url":"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/","name":"SQL++ Querying with Python - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/es\/#website"},"datePublished":"2023-06-23T08:43:43+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/es\/developers\/tutorials\/python-sql-querying\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"SQL++ Querying with Python"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/es\/#website","url":"https:\/\/www.couchbase.com\/es\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/es\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/es\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/es\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/es\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","contentUrl":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","width":1129,"height":1129,"caption":"Couchbase"},"image":{"@id":"https:\/\/www.couchbase.com\/es\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Couchbase\/","https:\/\/x.com\/couchbase","https:\/\/www.youtube.com\/c\/CouchbaseServer","https:\/\/www.linkedin.com\/company\/couchbase\/","https:\/\/github.com\/couchbase\/","https:\/\/en.wikipedia.org\/wiki\/Couchbase,_Inc."],"description":"Couchbase es una empresa de software de bases de datos con sede en San Jos\u00e9, California, que proporciona una plataforma de datos operativa para la inteligencia artificial utilizada por cientos de empresas globales.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/tutorials\/10350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/tutorials\/10350\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/media?parent=10350"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/tutorial-languages?post=10350"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/tutorial-tags?post=10350"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/tutorial-technologies?post=10350"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/es\/wp-json\/wp\/v2\/tutorial-types?post=10350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}