{"title":"Bunachair sonraí","version":"6.0","locale":"ga","docname":"ref/databases","url":"/ga/6.0/ref/databases/","canonical":"https://djangodocs.dev/ga/6.0/ref/databases/","summary":"Tacaíonn Django go hoifigiúil leis na bunachair sonraí seo. <third-party-notes>Tá roinnt cúltaca bunachar sonraí ann freisin: ref: `a sholáthraíonn tríú…","html":"<h1>Bunachair sonraí<a class=\"heading-anchor\" href=\"#databases\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Tacaíonn Django go hoifigiúil leis na bunachair sonraí seo</p>\n<ul class=\"simple\">\n<li><p>&lt;postgresql-notes&gt;:ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>PostgreSQL `</p></li>\n<li><p>&lt;mariadb-notes&gt;:ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>MariaDB `</p></li>\n<li><p>&lt;mysql-notes&gt;:ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>MySQL `</p></li>\n<li><p>&lt;oracle-notes&gt;:ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>Oracle `</p></li>\n<li><p>&lt;sqlite-notes&gt;:tagairt: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>SQLite `</p></li>\n</ul>\n<p>&lt;third-party-notes&gt;Tá roinnt cúltaca bunachar sonraí ann freisin: ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>a sholáthraíonn tríú páirtithe <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>.</p>\n<p>Déanann Django iarracht tacú leis an oiread gnéithe agus is féidir ar gach cúltaca bunachar sonraí. Mar sin féin, níl gach cúltaca bunachar sonraí mar an gcéanna, agus bhí orainn cinntí dearaidh a dhéanamh faoi na gnéithe le tacú le tacú leo agus na toimhdeanna is féidir linn a dhéanamh go sábháilte.</p>\n<p>Déanann an comhad seo cur síos ar chuid de na gnéithe a d'fhéadfadh a bheith ábhartha le húsáid Django. Níl sé beartaithe mar athsholáthar do dhoiciméadú nó lámhleabhair tagartha atá sonrach le freastalaí.</p>\n<section id=\"general-notes\">\n<h2>Nótaí ginearálta<a class=\"heading-anchor\" href=\"#general-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"persistent-connections\">\n<span id=\"persistent-database-connections\"></span><h3>Naisc leanúnacha<a class=\"heading-anchor\" href=\"#persistent-connections\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Seachnaíonn naisc leanúnacha an lasbhaird a bhaineann le nasc leis an mbunachar sonraí a athbhunú i ngach iarratas HTTP. Tá siad á rialú ag an bparaiméadar: setting: CONN_MAX_AGE a shainmhíníonn saolré uasta nasc. Is féidir é a shocrú go neamhspleách do gach bunachar sonraí.</p>\n<p>Is é “0” an luach réamhshocraithe, ag caomhnú an t-iompar stairiúil a bhaineann le nasc an bhunachar sonraí a dhúnadh ag deireadh gach iarratais. Chun naisc leanúnacha a chumasú, socraí:setting: CONN_MAX_AGE go sláimhir dearfach soicind. Maidir le naisc leanúnacha neamhtheoranta, socraigh é go <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>None <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>.</p>\n<p>When using ASGI, persistent connections should be disabled. Instead, use your\ndatabase backend's built-in connection pooling if available, or investigate a\nthird-party connection pooling option if required.</p>\n<section id=\"connection-management\">\n<h4>Bainistíocht nasc<a class=\"heading-anchor\" href=\"#connection-management\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Osclaíonn Django nasc leis an mbunachar sonraí nuair a dhéanann sé ceist bunachar sonraí ar dtús. Coinníonn sé an nasc seo oscailte agus athúsáideann sé é in iarratais ina dhiaidh sin. Dúnann Django an nasc nuair a sháraíonn sé an t-aois uasta atá sainmhínithe ag: setting: CONN_MAX_AGE nó nuair nach bhfuil sé inúsáidte a thuilleadh.</p>\n<p>Go mion, osclaíonn Django nasc leis an mbunachar sonraí go huathoibríoch aon uair a theastaíonn ceann uaidh agus níl ceann aige cheana féin - toisc gurb é seo an chéad nasc, nó toisc go raibh an nasc roimhe seo dúnta.</p>\n<p>Ag tús gach iarratais, dúnann Django an nasc má tá a uasaois bainte amach aige. Má chuireann do bhunachar sonraí deireadh le naisc díomhaoin tar éis roinnt ama, ba chóir duit:setting: CONN_MAX_AGE a shocrú go luach níos ísle, ionas nach ndéanfaidh Django iarracht nasc a chuir deireadh leis an bhfreastalaí bunachar sonraí a úsáid. (Ní fhéadfaidh an fhadhb seo dul i bhfeidhm ach ar shuíomhanna tráchta an-íseal.)</p>\n<p>Ag deireadh gach iarratais, dúnann Django an nasc má tá a uasaois bainte amach aige nó má tá sé i stát earráide neamh-inaisghabháilte. Má tharla aon earráidí bunachar sonraí agus na hiarrataí á bpróiseáil, seiceálann Django an n-oibríonn an nasc fós, agus dúnann sé mura ndéanann sé. Mar sin, bíonn tionchar ag earráidí bunachar sonraí ar iarratas amháin ar a mhéad in aghaidh an snáithe oibrí gach iarratais; má éiríonn an nasc neamhúsáidte, faigheann an chéad iarratas eile nasc úr</p>\n<p>Socraithe:Socrú: Is féidir CONN_HEALTH_CHECKS go <code class=\"docutils literal notranslate\">True</code> a úsáid chun láidneacht athúsáide nasc a fheabhsú agus earráidí a chosc nuair a dhúntar nasc ag an bhfreastalaí bunachar sonraí atá réidh anois chun nasc nua a ghlacadh agus a sheirbheáil, m.sh. tar éis freastalaí bunachar sonraí a atosú. Ní dhéantar an seiceáil sláinte ach uair amháin in aghaidh an iarratais agus ach amháin má tá rochtain ar an mbunachar sonraí le linn láimhseáil an iarratais.</p>\n</section>\n<section id=\"caveats\">\n<h4>Rabhadh<a class=\"heading-anchor\" href=\"#caveats\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Ós rud é go gcoinníonn gach snáithe a nasc féin, caithfidh do bhunachar sonraí tacú leis an oiread naisc chomhuaineach ar a laghad agus atá snáitheanna oi</p>\n<p>Uaireanta ní bhfaighidh tromlach do thuairimí rochtain ar bhunachar sonraí, mar shampla toisc gurb é bunachar sonraí córas seachtrach é, nó a bhuíochas le caching. I gcásanna den sórt sin, ba chóir duit:socrú: CONN_MAX_AGE go luach íseal nó fiú 0`, toisc nach bhfuil ciall aige nasc a choinneáil nach dócha go n-athúsáidfear. Cuideoidh sé seo líon na naisc chomhuaineach leis an mbunachar sonraí seo a choinneáil beag.</p>\n<p>Cruthaíonn an freastalaí forbartha snáithe nua do gach iarratas a láimhseálann sé, ag diúltú ar éifeacht naisc leanúnacha. Ná cuir ar chumas iad le linn na forbartha.</p>\n<p>Nuair a bhunaíonn Django nasc leis an mbunachar sonraí, bunaíonn sé paraiméadair iomchuí, ag brath ar an gcúltaca atá á úsáid. Má chumasaíonn tú naisc leanúnacha, ní dhéantar an socrú seo a athdhéanamh gach iarratas a thuilleadh. Má mhodhníonn tú paraiméadair mar leibhéal aonrú nó crios ama an nasc, ba cheart duit réamhshocruithe Django a athbhunú ag deireadh gach iarratais, luach cuí a chur i bhfeidhm ag tús gach iarratais, nó naisc leanúnacha a dhíchumasú.</p>\n<p>Má chruthaítear nasc i bpróiseas fadtéarmach, lasmuigh de thimthriall iarrata-freagartha Django, fanfaidh an nasc oscailte go dtí go ndúnfar go sainráite, nó go dtarlóidh an t-am. Is féidir leat <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>django.db.close_old_connexions () <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>a úsáid chun gach sean-nasc nó neamhúsáidte a dhúnadh.</p>\n</section>\n</section>\n<section id=\"encoding\">\n<h3>Ionchódú<a class=\"heading-anchor\" href=\"#encoding\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Glacann Django leis go n-úsáideann gach bunachar sonraí ionchódú UTF-8. D'fhéadfadh iompar gan choinne mar earráidí “luach rófhada” ó do bhunachar sonraí a bheith mar thoradh ar ionchódú eile a úsáid le haghaidh sonraí atá bailí i Django. Féach na nótaí sonracha bunachar sonraí thíos chun faisnéis a fháil ar conas do bhunachar sonraí a chur ar bun i gceart</p>\n</section>\n</section>\n<section id=\"postgresql-notes\">\n<span id=\"id1\"></span><h2>Nótaí PostgreSQL<a class=\"heading-anchor\" href=\"#postgresql-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django supports PostgreSQL 14 and higher. <a class=\"reference external\" href=\"https://www.psycopg.org/psycopg3/\">psycopg</a> 3.1.12+ or <a class=\"reference external\" href=\"https://www.psycopg.org/\">psycopg2</a>\n2.9.9+ is required, though the latest <a class=\"reference external\" href=\"https://www.psycopg.org/psycopg3/\">psycopg</a> 3.1.12+ is recommended.</p>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>Is dóigh go ndéanfar tacaíocht do psycopg2 a dhíchur agus a bhaint ag pointe éigin sa todhchaí.</p>\n</aside>\n<section id=\"postgresql-connection-settings\">\n<span id=\"id2\"></span><h3>Socruithe nasc PostgreSQL<a class=\"heading-anchor\" href=\"#postgresql-connection-settings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Féach: socrú: HOST le haghaidh sonraí.</p>\n<p>Chun ceangal ag baint úsáide as ainm seirbhíse ón <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/libpq-pgpass.html\">comhad seirbhíse nasc</a> agus pasfhocal ón <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/libpq-pgservice.html\">comhad pasfhocal</a>, ní mór duit iad a shonrú sa chuid:setting: OPTIONS de do chumraíocht bunachar sonraí in:setting: DATABASES:</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"python\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\">settings.py</code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.postgresql&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;service&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;my_service&quot;</span><span class=\"p\">,</span>\n            <span class=\"s2\">&quot;passfile&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;.my_pgpass&quot;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">}</span>\n</code></pre></figure>\n<figure class=\"code-block code-block-captioned\" data-language=\"text\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\">.pg_service.conf</code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Text code\"><code>[my_service]\nhost=localhost\nuser=USER\ndbname=NAME\nport=5432\n</code></pre></figure>\n<figure class=\"code-block code-block-captioned\" data-language=\"text\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\">.my_pgpass</code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Text code\"><code>localhost:5432:NAME:USER:PASSWORD\n</code></pre></figure>\n<p>Cuireann cúltaca PostgreSQL ábhar de:setting: OPTIONS mar argóintí eochairfhocal chuig an tógálaí nasc, rud a ligeann rialú níos airde ar iompar tiománaí. Déantar cur síos mion ar na paraiméadair go léir atá ar fáil i ndoiciméadú PostgreSQL.</p>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">Warning</p>\n<p>Ní thacaítear le húsáid ainm seirbhíse chun críocha tástála. &lt;33685&gt;Seo:ticéad: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>féadfar a chur i bhfeidhm níos déanaí <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>.</p>\n</aside>\n</section>\n<section id=\"optimizing-postgresql-s-configuration\">\n<h3>Cumraíocht PostgreSQL a bharrfheabhsú<a class=\"heading-anchor\" href=\"#optimizing-postgresql-s-configuration\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Teastaíonn Django na paraiméadair seo a leanas dá naisc bunachar sonraí:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">client_encoding</code>: <code class=\"docutils literal notranslate\">`UTF8'</code>,</p></li>\n<li><p><code class=\"docutils literal notranslate\">default_transaction_isolation</code>: <code class=\"docutils literal notranslate\">'read committed'</code> de réir réamhshocraithe, nó an luach atá leagtha síos sna roghanna nasc (féach thíos),</p></li>\n<li><dl class=\"simple\">\n<dt><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>crios ama <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>:</dt><dd><ul>\n<li><p>&lt;DATABASE-TIME_ZONE&gt;nuai:setting: is é USE_TZ <code class=\"docutils literal notranslate\">True</code>, <code class=\"docutils literal notranslate\">UTC'</code> de réir réamhshocraithe, nó an:setting: TIME_ZON luach socraithe don nasc,</p></li>\n<li><p>nuai:setting: USE_TZ <code class=\"docutils literal notranslate\">False</code>, luach an socrú domhanna:setting: TIME_ZONE.</p></li>\n</ul>\n</dd>\n</dl>\n</li>\n</ul>\n<p>Má tá na luachanna cearta ag na paraiméadair seo cheana féin, ní shocróidh Django iad do gach nasc nua, rud a fheabhsaíonn feidhmíocht beagán. Is féidir leat iad a chumrú go díreach in:file: postgresql.conf nó níos áisiúla in aghaidh an úsáideora bunachar sonraí le <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/sql-alterrole.html\">ALTER ROLE</a>.</p>\n<p>Oibreoidh Django go breá gan an barrfheabhsú seo, ach déanfaidh gach nasc nua roinnt ceisteanna breise chun na paraiméadair seo a shocrú.</p>\n</section>\n<section id=\"isolation-level\">\n<span id=\"database-isolation-level\"></span><h3>Leibhéal aonrú<a class=\"heading-anchor\" href=\"#isolation-level\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Cosúil le PostgreSQL féin, déanann Django réamhshocrú ar an leibhéal aonair <code class=\"docutils literal notranslate\">READ COMMITTED`_. Má theastaíonn leibhéal aonrúcháin níos airde uait mar ``REPEATABLE READ ``nó `SERIALIZABLE</code>, socraigh é sa chuid:SETTING: OPTIONS de chumraíocht do bhunachar sonraí in:setting: DATABASES:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.postgresql.psycopg_any</span> <span class=\"kn\">import</span> IsolationLevel\n\nDATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"c1\"># ...</span>\n    <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;isolation_level&quot;</span><span class=\"p\">:</span> IsolationLevel<span class=\"o\">.</span>SERIALIZABLE<span class=\"p\">,</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>Faoi leibhéil aonrú níos airde, ba cheart d'iarratas a bheith ullmhaithe chun eisceachtaí a ardaítear ar theipeanna sraitheach Tá an rogha seo deartha le haghaidh ardúsáidí.</p>\n</aside>\n</section>\n<section id=\"role\">\n<span id=\"database-role\"></span><h3>Ról<a class=\"heading-anchor\" href=\"#role\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you need to use a different role for database connections than the role used\nto establish the connection, set it in the <a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS</code></a> part of your\ndatabase configuration in <a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-DATABASES\"><code class=\"xref std std-setting docutils literal notranslate\">DATABASES</code></a>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.postgresql&quot;</span><span class=\"p\">,</span>\n        <span class=\"c1\"># ...</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;assume_role&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;my_application_role&quot;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n</section>\n<section id=\"connection-pool\">\n<span id=\"postgresql-pool\"></span><h3>Linn snámha nasc<a class=\"heading-anchor\" href=\"#connection-pool\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Chun linn nasc le <a class=\"reference external\" href=\"https://www.psycopg.org/psycopg3/\">psycopg</a> a úsáid, is féidir leat <code class=\"docutils literal notranslate\">&quot;pool&quot;</code> a shocrú sa chuid:setting: OPTIONS de do chumraíocht bunachar sonraí in:setting: DATABASES chun a bheith ina dict le rith chuig:class: ~psycopg:psycopg_pool.connectionpool, nó go <code class=\"docutils literal notranslate\">True</code> chun an Connectionpool` def` a úsáid buntáistí:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.postgresql&quot;</span><span class=\"p\">,</span>\n        <span class=\"c1\"># ...</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;pool&quot;</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Éilíonn an rogha seo <code class=\"docutils literal notranslate\">psycopg [pool] ``nó:pypi: `psycopg-pool` a shuiteáil agus neamhaird a dhéanamh air le `psycopg2</code>.</p>\n</section>\n<section id=\"server-side-parameters-binding\">\n<span id=\"database-server-side-parameters-binding\"></span><h3>Paraiméadair taobh an fhreastalaí<a class=\"heading-anchor\" href=\"#server-side-parameters-binding\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>&lt;psycopg:client-side-binding-cursors&gt;Le <a class=\"reference external\" href=\"https://www.psycopg.org/psycopg3/\">psycopg</a> 3.1.8+, déanann Django réamhshocraithe ar na: ref: cúrsaí ceangailte taobh an chliaint `. Más mian leat an: ref: `ceangailt taobh freastala &lt;psycopg:server-side-binding&gt;í `a úsáid, socraigh é sa chuid:setting: `OPTIONS de do chumraíocht bunachar sonraí in:setting: DATABASES:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.postgresql&quot;</span><span class=\"p\">,</span>\n        <span class=\"c1\"># ...</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;server_side_binding&quot;</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Déantar neamhaird ar an rogha seo le psycopg2`.</p>\n</section>\n<section id=\"indexes-for-varchar-and-text-columns\">\n<h3>Innéacsanna do cholúin <code class=\"docutils literal notranslate\">varchar</code> agus <code class=\"docutils literal notranslate\">text</code><a class=\"heading-anchor\" href=\"#indexes-for-varchar-and-text-columns\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>When specifying <code class=\"docutils literal notranslate\">db_index=True</code> on your model fields, Django typically\noutputs a single <code class=\"docutils literal notranslate\">CREATE INDEX</code> statement. However, if the database type\nfor the field is either <code class=\"docutils literal notranslate\">varchar</code> or <code class=\"docutils literal notranslate\">text</code> (e.g., used by <code class=\"docutils literal notranslate\">CharField</code>,\n<code class=\"docutils literal notranslate\">FileField</code>, and <code class=\"docutils literal notranslate\">TextField</code>), then Django will create\nan additional index that uses an appropriate <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/indexes-opclass.html\">PostgreSQL operator class</a>\nfor the column. The extra index is necessary to correctly perform\nlookups that use the <code class=\"docutils literal notranslate\">LIKE</code> operator in their SQL, as is done with the\n<code class=\"docutils literal notranslate\">contains</code> and <code class=\"docutils literal notranslate\">startswith</code> lookup types.</p>\n</section>\n<section id=\"migration-operation-for-adding-extensions\">\n<h3>Oibríocht imirce chun síntí a chur<a class=\"heading-anchor\" href=\"#migration-operation-for-adding-extensions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Más gá duit síneadh PostgreSQL a chur leis (cosúil le <code class=\"docutils literal notranslate\">hstore</code>, postgis`, srl.) ag baint úsáide as imirce, bain úsáid as an oibríocht: :class: ~django.contrib.postgres.operations.createExtension.</p>\n</section>\n<section id=\"server-side-cursors\">\n<span id=\"postgresql-server-side-cursors\"></span><h3>Cúrsaí taobh an fhreastalaí<a class=\"heading-anchor\" href=\"#server-side-cursors\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>&lt;django.db.models.query.QuerySet.iterator&gt;&lt;psycopg:server-side-cursors&gt;Nuair a úsáidtear: meth: QuerySet.iterator () `, osclaíonn Django a:ref: `cúrsóir taobh freastalaí. De réir réamhshocraithe, glacann PostgreSQL leis nach bhfaighfear ach an chéad 10% de thorthaí na gceisteanna cúrsóra a fháil. Caitheann an pleanálaí fiosrúcháin níos lú ama a phleanáil an cheist agus tosaíonn sé torthaí a thabhairt ar ais níos gasta, ach d'fhéadfadh sé seo feidhmíocht a laghdú má aisghairtear níos mó ná 10% Rialaítear toimhdí PostgreSQL ar líon na sraitheanna a aisghabháiltear le haghaidh ceist cúrsóra leis an rogha <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-CURSOR-TUPLE-FRACTION\">cursor_tuple_fraction</a>.</p>\n<section id=\"transaction-pooling-and-server-side-cursors\">\n<span id=\"transaction-pooling-server-side-cursors\"></span><h4>Comhdhlúthú idirbheart agus cúrsaí taobh an fhreastalaí<a class=\"heading-anchor\" href=\"#transaction-pooling-and-server-side-cursors\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Teastaíonn cúrsóirí taobh an fhreastalaí a dhíchumasú don nasc sin a úsáid i mód comhiontála idirbheart (m.sh. <a class=\"reference external\" href=\"https://www.pgbouncer.org/\">PGBouncer</a>).</p>\n<p>&lt;DATABASE-AUTOCOMMIT&gt;Tá cúrsóirí taobh an fhreastalaí áitiúil le nasc agus fanann siad oscailte ag deireadh idirbheart nuai:socrú: AUTOCOMMIT <code class=\"docutils literal notranslate\">True</code>. Féadfaidh idirbheart ina dhiaidh sin iarracht a dhéanamh níos mó torthaí a fháil ó chúrsóir taobh an fhreastalaí. I mód comhiontála idirbheart, níl aon ráthaíocht ann go n-úsáidfidh idirbhearta ina dhiaidh sin an nasc céanna. Má úsáidtear nasc difriúil, ardaítear earráid nuair a thagraíonn an t-idirbheart don chúrsóir taobh an fhreastalaí, toisc nach bhfuil cúrsóirí taobh an fhreastalaí inrochtana ach sa nasc inar cruthaíodh iad.</p>\n<p>&lt;DATABASE-DISABLE_SERVER_SIDE_CURSORS&gt;Réiteach amháin is ea cursóirí taobh an fhreastalaí a dhíchumasú le haghaidh nasc in:setting: DATABASES trí shocrú: socrú: DISABLE_SERVER_SIDE_CURSORS `go ``True`.</p>\n<p>Chun leas a bhaint as cúrsóirí taobh an fhreastalaí i mód comhiomlánaithe idirbheart, d'fhéadfá: doc: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>nasc eile leis an mbunachar sonraithe' a chur ar bun d'fhonn ceisteanna a dhéanamh a úsáideann cúrsaí taobh an fhreastala&lt;/topics/db/multi-db&gt; í. Caithfidh an nasc seo a bheith go díreach chuig an mbunachar sonraí nó le seoltóir nasc i mód comhiomlánaithe seisiúin.</p>\n<p>Rogha eile is ea gach <code class=\"docutils literal notranslate\">QuerySet</code> a fhilleadh ag baint úsáide as cúrsaí taobh an fhreastalaí i mbloc:func: ~django.db.transaction.atomic, toisc go ndéanann sé <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>autocommit <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>a dhíchumasú ar feadh ré an idirbheart. Ar an mbealach seo, ní bheidh an cúrsóir taobh an fhreastalaí beo ach ar feadh tréimhse an idirbheart.</p>\n</section>\n</section>\n<section id=\"manually-specifying-values-of-auto-incrementing-primary-keys\">\n<span id=\"manually-specified-autoincrement-pk\"></span><h3>Luachanna na n-eochracha bunscoile atá ag méadú uathoibríoch<a class=\"heading-anchor\" href=\"#manually-specifying-values-of-auto-incrementing-primary-keys\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Úsáideann Django colúin aitheantais PostgreSQL chun eochracha bunmhéadaithe uathoibríoch a stóráil. Tá luachanna ó <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/sql-createsequence.html\">seicheamh</a> i gcolún aitheantais a choinníonn súil ar an gcéad luach eile atá ar fáil. Ní dhéanann luach a shannadh de láimh do réimse uathoibríoch a nuashonrú seicheamh an réimse, rud a d'fhéadfadh coinbhleacht a bheith ina chúis níos déanaí. Mar shampla:</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"kn\">from</span> <span class=\"nn\">django.contrib.auth.models</span> <span class=\"kn\">import</span> User\n<span class=\"gp\">&gt;&gt;&gt; </span>User<span class=\"o\">.</span>objects<span class=\"o\">.</span>create<span class=\"p\">(</span>username<span class=\"o\">=</span><span class=\"s2\">&quot;alice&quot;</span><span class=\"p\">,</span> pk<span class=\"o\">=</span><span class=\"mi\">1</span><span class=\"p\">)</span>\n<span class=\"go\">&lt;User: alice&gt;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"c1\"># The sequence hasn&#39;t been updated; its next value is 1.</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>User<span class=\"o\">.</span>objects<span class=\"o\">.</span>create<span class=\"p\">(</span>username<span class=\"o\">=</span><span class=\"s2\">&quot;bob&quot;</span><span class=\"p\">)</span>\n<span class=\"go\">IntegrityError: duplicate key value violates unique constraint</span>\n<span class=\"go\">&quot;auth_user_pkey&quot; DETAIL:  Key (id)=(1) already exists.</span>\n</code></pre></div>\n<p>Más gá duit luachanna den sórt sin a shonrú, athshocraigh an seicheamh ina dhiaidh sin chun luach atá sa tábla cheana féin a athúsáid a sheachaint. Gineann an t-ordú bainistíochta: Djadmin: sqlsequencereset na ráitis SQL chun é sin a dhéanamh.</p>\n</section>\n<section id=\"test-database-templates\">\n<h3>Teimpléid bhunachar sonraí<a class=\"heading-anchor\" href=\"#test-database-templates\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Is féidir leat an socrú:setting: <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/sql-createdatabase.html\">TEST ['&lt;TEST_TEMPLATE&gt;TEMPLATE'] `a úsáid chun `teimpléad</a> a shonrú (m.sh. <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>'teimpléad0'<a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>) uaidh chun bunachar sonraí tástála a chruthú.</p>\n</section>\n<section id=\"speeding-up-test-execution-with-non-durable-settings\">\n<h3>Forghníomhú tástála a bhrostú le socruithe neamh-bhuan<a class=\"heading-anchor\" href=\"#speeding-up-test-execution-with-non-durable-settings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>&lt; <a class=\"reference external\" href=\"https://www.postgresql.org/docs/current/non-durability.html\">https://www.postgresql.org/docs/current/non-durability.html</a>&gt;Is féidir leat amanna forghníomhaithe tástála a bhrostú trí <a href=\"#id21\"><span class=\"problematic\" id=\"id22\">`PostgreSQL a chumrú le bheith neamh-bhuanaithe`_</span></a>.</p>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">Warning</p>\n<p>Tá sé seo contúirteach: déanfaidh sé do bhunachar sonraí níos so-ghabháilte do chaillteanas sonraí nó éilliú i gcás timpiste freastalaí nó caillteanas cumhachta. Úsáid é seo ach ar mheaisín forbartha inar féidir leat ábhar iomlán na mbunachar sonraí go léir sa bhraisle a athbhunú go héasca.</p>\n</aside>\n</section>\n</section>\n<section id=\"mariadb-notes\">\n<span id=\"id4\"></span><h2>Nótaí MariaDB<a class=\"heading-anchor\" href=\"#mariadb-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django supports MariaDB 10.6 and higher.</p>\n<p>Chun MariaDB a úsáid, bain úsáid as an gcúltaca MySQL, atá roinnte idir an dá cheann. Féach na:ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>Nótaí MySQL &lt;mysql-notes&gt;`le haghaidh tuilleadh sonraí.</p>\n</section>\n<section id=\"mysql-notes\">\n<span id=\"id5\"></span><h2>Nótaí MySQL<a class=\"heading-anchor\" href=\"#mysql-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"version-support\">\n<h3>Tacaíocht leagan<a class=\"heading-anchor\" href=\"#version-support\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Tacaíonn Django le MySQL 8.0.11 agus níos airde.</p>\n<p>Úsáideann gné <code class=\"docutils literal notranslate\">inspectdb ``Django an bunachar sonraí `information_schema</code>, ina bhfuil sonraí mionsonraithe ar gach scéim bunachar sonraí.</p>\n<p>Tá Django ag súil go dtacóidh an bunachar sonraí le Unicode (ionchódú UTF-8) agus a thosclaíonn sé dó idirbhearta agus sláine tagartha a fhorfheidhmiú. Tá sé tábhachtach a bheith ar an eolas faoin bhfíric nach bhforfheidhmíonn MySQL an dá cheann deireanach i ndáiríre agus an t-inneall stórála MyISAM á úsáid agat, féach an chéad chuid eile.</p>\n</section>\n<section id=\"storage-engines\">\n<span id=\"mysql-storage-engines\"></span><h3>Innill stórála<a class=\"heading-anchor\" href=\"#storage-engines\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Tá roinnt <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/storage-engines.html\">inneall stórála</a> ag MySQL. Is féidir leat an t-inneall stórála réamhshocraithe a athrú i gcumraíocht na freastala</p>\n<p>Is é <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/innodb-storage-engine.html\">InnoDB</a> inneall stórála réamhshocraithe MySQL. Tá an t-inneall seo idirbheart go hiomlán agus tacaíonn sé le príomhthagairtí eachtracha. Is é an rogha a mholtar é. Mar sin féin, cailltear cuntar autoincrement InnoDB ar atosú MySQL toisc nach gcuimhneann sé an luach AUTO_INCREMENT`, ina ionad sin é a athchruthú mar “max (id) +1&quot;. D'fhéadfadh luachanna: class: ~Django.db.Models.AutoField athúsáid neamhthuigneach mar thoradh air seo.</p>\n<p>Is iad príomh-mhíbhuntáistí <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/myisam-storage-engine.html\">MyISAM</a> ná nach dtacaíonn sé le hidirbhearta nó nach bhforfheidhmíonn sé srianta eachtracha eachtrach.</p>\n</section>\n<section id=\"mysql-db-api-drivers\">\n<span id=\"id7\"></span><h3>Tiománaithe API MySQL DB<a class=\"heading-anchor\" href=\"#mysql-db-api-drivers\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Tá cúpla tiománaí ag MySQL a chuireann an API Bunachar Sonraí Python i bhfeidhm a thuairiscítear in:pep: 249:</p>\n<ul class=\"simple\">\n<li><p><a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/mysqlclient/\">mysqlclient</a> is a native driver. It's <strong>the recommended choice</strong>.</p></li>\n<li><p>Is tiománaí íon Python ó Oracle é <a class=\"reference external\" href=\"https://dev.mysql.com/downloads/connector/python/\">MySQL Connector/Python</a> nach dteastaíonn leabharlann cliant MySQL nó aon mhodúil Python lasmuigh den leabharlann chaighdeánach.</p></li>\n</ul>\n<p>Chomh maith le tiománaí API DB, teastaíonn oiriúnóir ó Django chun rochtain a fháil ar na tiománaithe bunachar sonraí óna ORM. Soláthraíonn Django cuibheoir do mysqlclient agus cuimsíonn MySQL Connector/Python <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>a chuid féin <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>_.</p>\n<section id=\"mysqlclient\">\n<h4>mysqlclient<a class=\"heading-anchor\" href=\"#mysqlclient\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Django requires <a class=\"reference internal\" href=\"#mysqlclient\">mysqlclient</a> 2.2.1 or later.</p>\n</section>\n<section id=\"id8\">\n<h4>Ceanglóir MySQL/Python<a class=\"heading-anchor\" href=\"#id8\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Tá MySQL Connector/Python ar fáil ón leathanach <a class=\"reference external\" href=\"https://dev.mysql.com/downloads/connector/python/\">íoslódálaí</a>. Tá an t-oiriúntóir Django ar fáil i leaganacha 1.1.X agus níos déanaí. B'fhéidir nach dtacaíonn sé leis na heisiúintí is déanaí de Django.</p>\n</section>\n</section>\n<section id=\"time-zone-definitions\">\n<span id=\"mysql-time-zone-definitions\"></span><h3>Sainmhínithe crios ama<a class=\"heading-anchor\" href=\"#time-zone-definitions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Má tá sé ar intinn agat Django's:doc: timezone taca a úsáid, bain úsáid as <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/mysql-tzinfo-to-sql.html\">mysql_tzinfo_to_sql</a> chun táblaí cri&lt;/topics/i18n/timezones&gt; os ama a luchtú isteach sa bhunachar sonraí MySQL. Ní mór é seo a dhéanamh uair amháin do do fhreastalaí MySQL, ní in aghaidh an bhunachar sonraí.</p>\n</section>\n<section id=\"creating-your-database\">\n<h3>Cruthú do bhunachar sonraí<a class=\"heading-anchor\" href=\"#creating-your-database\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Is féidir leat <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/create-database.html\">do bhunachar sonraí a chruthai</a> ag baint úsáide as na huirlisí líne ordaithe agus an SQL seo:</p>\n<div class=\"code-block\" data-language=\"sql\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">SQL</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"SQL code\"><code><span class=\"k\">CREATE</span> <span class=\"k\">DATABASE</span> <span class=\"o\">&lt;</span>dbname<span class=\"o\">&gt;</span> <span class=\"nb\">CHARACTER</span> <span class=\"k\">SET</span> utf8mb4<span class=\"p\">;</span>\n</code></pre></div>\n<p>Cinntíonn sé seo go n-úsáidfidh gach tábla agus colún UTF-8 de réir réamhshocraithe.</p>\n<section id=\"collation-settings\">\n<span id=\"mysql-collation\"></span><h4>Socruithe coláireachta<a class=\"heading-anchor\" href=\"#collation-settings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Rialaíonn an socrú comhlánaithe do cholún an t-ord ina ndéantar sonraí a shórtáil chomh maith leis na teaghráin a gcomparáid mar chomhionann. &lt;django.db.models.CharField.db_collation&gt;&lt;django.db.models.TextField.db_collation&gt;Is féidir leat an paraiméadar <code class=\"docutils literal notranslate\">db_collation</code> a shonrú chun ainm comhlánaithe an cholúin a shocrú le haghaidh: attr: CharField `agus:attr: `TextField.</p>\n<p>Is féidir an bailiú a shocrú freisin ar leibhéal ar fud an mbunachar sonraí agus in aghaidh an tábla. Tá sé seo <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/charset.html\">doiciméadaithe go críochnú</a> sa doiciméadú MySQL. I gcásanna den sórt sin, ní mór duit an comhlánú a shocrú trí na socruithe nó na táblaí bunachar sonraí a ionramháil go díreach. Ní sholáthraíonn Django API chun iad a athrú.</p>\n<p>By default, with a UTF-8 database, MySQL will use the\n<code class=\"docutils literal notranslate\">utf8mb4_0900_ai_ci</code> collation. This results in all string equality\ncomparisons being done in a <em>case-insensitive</em> manner. That is, <code class=\"docutils literal notranslate\">&quot;Fred&quot;</code> and\n<code class=\"docutils literal notranslate\">&quot;freD&quot;</code> are considered equal at the database level. If you have a unique\nconstraint on a field, it would be illegal to try to insert both <code class=\"docutils literal notranslate\">&quot;aa&quot;</code> and\n<code class=\"docutils literal notranslate\">&quot;AA&quot;</code> into the same column, since they compare as equal (and, hence,\nnon-unique) with the default collation. If you want case-sensitive comparisons\non a particular column or table, change the column or table to use the\n<code class=\"docutils literal notranslate\">utf8mb4_0900_as_cs</code> collation.</p>\n<p>Please note that according to <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/charset-unicode-sets.html\">MySQL Unicode Character Sets</a>, comparisons for\nthe <code class=\"docutils literal notranslate\">utf8mb4_general_ci</code> collation are faster, but slightly less correct,\nthan comparisons for <code class=\"docutils literal notranslate\">utf8mb4_unicode_ci</code>. If this is acceptable for your\napplication, you should use <code class=\"docutils literal notranslate\">utf8mb4_general_ci</code> because it is faster. If\nthis is not acceptable (for example, if you require German dictionary order),\nuse <code class=\"docutils literal notranslate\">utf8mb4_unicode_ci</code> because it is more accurate.</p>\n<aside class=\"admonition admonition-warning\" role=\"note\">\n<p class=\"admonition-title\">Warning</p>\n<p>Bailíonn foirmeacha samhlacha réimsí uathúla ar bhealach cás-íogair. Mar sin nuair a úsáidtear comhdhlúthú cás-neamh-íogair, rachaidh foirm le luachanna réimse uathúla nach bhfuil difriúil ach de réir cháis bailíochtú, ach nuair a ghlaoch ar save () `, ardófar <code class=\"docutils literal notranslate\">IntegrityError</code>.</p>\n</aside>\n</section>\n</section>\n<section id=\"connecting-to-the-database\">\n<h3>Ceangal leis an mbunachar sonraí<a class=\"heading-anchor\" href=\"#connecting-to-the-database\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Féach ar an doiciméadú: socruithe doiciméadúsaí &lt;/ref/settings&gt;.</p>\n<p>Úsáidtear socruithe nasc san ord seo:</p>\n<ol class=\"arabic simple\">\n<li><p>: socrú: ROGHANNAÍ.</p></li>\n<li><p><a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-NAME\"><code class=\"xref std std-setting docutils literal notranslate\">NAME</code></a>, <a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-USER\"><code class=\"xref std std-setting docutils literal notranslate\">USER</code></a>, <a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-PASSWORD\"><code class=\"xref std std-setting docutils literal notranslate\">PASSWORD</code></a>, <a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-HOST\"><code class=\"xref std std-setting docutils literal notranslate\">HOST</code></a>,\n<a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-PORT\"><code class=\"xref std std-setting docutils literal notranslate\">PORT</code></a></p></li>\n<li><p>Comhaid rogha MySQL.</p></li>\n</ol>\n<p>Is é sin le rá, má shocraíonn tú ainm an bhunachar sonraí in:setting: OPTIONS, beidh tosaíocht aige seo thair:setting: NAME, a chuirfeadh aon rud i gcomhad rogha <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/option-files.html\">MySQL</a> a sháraigh.</p>\n<p>Seo cumraíocht shamplach a úsáideann comhad rogha MySQL:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"c1\"># settings.py</span>\nDATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.mysql&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;read_default_file&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;/path/to/my.cnf&quot;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<div class=\"code-block\" data-language=\"ini\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Ini</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Ini code\"><code><span class=\"c1\"># my.cnf</span>\n<span class=\"k\">[client]</span>\n<span class=\"na\">database</span> <span class=\"o\">=</span> <span class=\"s\">NAME</span>\n<span class=\"na\">user</span> <span class=\"o\">=</span> <span class=\"s\">USER</span>\n<span class=\"na\">password</span> <span class=\"o\">=</span> <span class=\"s\">PASSWORD</span>\n<span class=\"na\">default-character-set</span> <span class=\"o\">=</span> <span class=\"s\">utf8mb4</span>\n</code></pre></div>\n<p>D'fhéadfadh go mbeadh roinnt roghanna ceangail MySQLDB `_ eile úsáideach, mar shampla ``ssl`, <code class=\"docutils literal notranslate\">init_command ``, agus ``sql_mode</code>.</p>\n<section id=\"setting-sql-mode\">\n<span id=\"mysql-sql-mode\"></span><h4>Socrú <code class=\"docutils literal notranslate\">sql_mode</code><a class=\"heading-anchor\" href=\"#setting-sql-mode\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Tá <code class=\"docutils literal notranslate\">STRICT_TRANS_TABLES</code> sa luach réamhshocraithe den rogha <code class=\"docutils literal notranslate\">sql_mode</code>. Méadaíonn an rogha sin rabhaidh ina earráidí nuair a ghearrtar sonraí nuair a chuirtear isteach orthu, mar sin molann Django go mór modh dian `_ a ghníomhachtú do MySQL chun caillteanas sonraí a chosc (`STRICT_TRANS_TABLES` nó <code class=\"docutils literal notranslate\">STRICT_ALL_TABLES</code>).</p>\n<p>Más gá duit an modh SQL a shaincheapadh, is féidir leat an athróg <code class=\"docutils literal notranslate\">sql_mode</code> a shocrú cosúil le roghanna MySQL eile: i gcomhad cumraithe nó leis an iontráil <code class=\"docutils literal notranslate\">'init_command': “SET SQL_MODE='STRICT_TRANS_TABLES'&quot;</code> san :setting: OPTIONS cuid de do chumraíocht bunachar sonraí in:setting: DATABASES.</p>\n</section>\n<section id=\"mysql-isolation-level\">\n<span id=\"id9\"></span><h4>Leibhéal aonrú<a class=\"heading-anchor\" href=\"#mysql-isolation-level\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Agus ualaí comharthacha á rith, féadfaidh idirbhearta bunachar sonraí ó sheisiúin éagsúla (abair, snáitheanna ar leithligh a láimhseálann iarrat Bíonn tionchar ag <a class=\"reference external\" href=\"https://dev.mysql.com/doc/refman/en/innodb-transaction-isolation-levels.html\">leibhéal aonrú idirbhearta</a> gach seisiúin ar na hidirghníomhaíochtaí seo. Is féidir leat leibhéal aonrú nasc a shocrú le iontráil <code class=\"docutils literal notranslate\">'isolation_level'</code> sa chuid:setting: OPTIONS de chumraíocht do bhunachar sonraí in:setting: DATABASES. Is iad na ceithre leibhéal aonrú caighdeánacha luachanna bailí don iontráil seo:</p>\n<ul class=\"simple\">\n<li><p><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>'léamh neamhchoitianta `</p></li>\n<li><p><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>'choiste léitheach'</p></li>\n<li><p><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>'inléite athsheolacha'</p></li>\n<li><p><code class=\"docutils literal notranslate\">``sraitheach</code></p></li>\n</ul>\n<p>nó <code class=\"docutils literal notranslate\">None</code> chun leibhéal aonrú cumraithe an fhreastalaí a úsáid. Mar sin féin, is fearr a oibríonn Django le léamh tiomanta agus déanann sé réamhshocraithe léamh MySQL seachas léamh réamhshocraithe MySQL. Is féidir caillteanas sonraí a dhéanamh le léamh in-athsheolta. Go háirithe, b'fhéidir go bhfeicfidh tú cásanna ina n-ardóidh: meth: ~django.db.models.query.queryset.get_or_create an:exc: ~django.db.IntegrityError ach ní bheidh an réad le feiceáil i nglaoch ina dhiaidh sin: ~django.db.models.queryset.get.</p>\n</section>\n</section>\n<section id=\"creating-your-tables\">\n<h3>Do tháblaí a chruthú<a class=\"heading-anchor\" href=\"#creating-your-tables\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Nuair a ghineann Django an scéim, ní shonraíonn sé inneall stórála, mar sin cruthófar táblaí le cibé inneall stórála réamhshocraithe a bhfuil do fhreastalaí bunachar sonraí cumraithe dó. Is é an réiteach is éasca inneall stórála réamhshocraithe do fhreastalaí bunachar sonraí a shocrú go dtí an t-inneall</p>\n<p>Má tá seirbhís óstála á úsáid agat agus mura féidir leat inneall stórála réamhshocraithe do fhreastalaí a athrú, tá cúpla rogha agat.</p>\n<ul>\n<li><p>Tar éis na táblaí a chruthú, déan ráiteas <code class=\"docutils literal notranslate\">ALTER TABLE</code> a fhorghníomhú chun tábla a thiontú go inneall stórála nua (mar shampla InnoDB):</p>\n<div class=\"code-block\" data-language=\"sql\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">SQL</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"SQL code\"><code><span class=\"k\">ALTER</span> <span class=\"k\">TABLE</span> <span class=\"o\">&lt;</span>tablename<span class=\"o\">&gt;</span> ENGINE<span class=\"o\">=</span>INNODB<span class=\"p\">;</span>\n</code></pre></div>\n<p>Is féidir leis seo a bheith deacair má tá a lán táblaí agat.</p>\n</li>\n<li><p>Rogha eile is ea an rogha <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>init_command <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>a úsáid le haghaidh MySQLDB sula gcruthóidh tú do tháblaí:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;init_command&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;SET default_storage_engine=INNODB&quot;</span><span class=\"p\">,</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Socraíonn sé seo an t-inneall stórála réamhshocraithe nuair a cheanglaíonn sé leis an Tar éis do tháblaí a chruthú, ba cheart duit an rogha seo a bhaint toisc go gcuireann sé ceist nach gá ach le linn cruthú tábla le gach nasc bunachar sonraí.</p>\n</li>\n</ul>\n</section>\n<section id=\"table-names\">\n<h3>Ainmneacha tábla<a class=\"heading-anchor\" href=\"#table-names\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Tá <a class=\"reference external\" href=\"https://bugs.mysql.com/bug.php?id=48875\">saincheisteanna aitheanna</a> ann fiú sna leaganacha is déanaí de MySQL a d'fhéadfadh a bheith ina chúis le cás ainm tábla a athrú nuair a dhéantar ráitis SQL áirithe a fhorghníomhú faoi choinníollacha áirithe. Moltar duit ainmneacha tábla beaga a úsáid, más féidir, chun aon fhadhbanna a d'fhéadfadh teacht chun cinn ón iompar seo a sheachaint. Úsáideann Django ainmneacha tábla beaga nuair a ghineann sé ainmneacha tábla go huathoibríoch ó mhúnlaí, mar sin is breithniú é seo den chuid is mó má tá tú ag dul i bhfeidhm ar ainm an tábla tríd an bparaiméadar: Class: ~Django.DB.Models.Options.DB_Table.</p>\n</section>\n<section id=\"savepoints\">\n<h3>Sábháilteachta<a class=\"heading-anchor\" href=\"#savepoints\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>&lt;topics-db-transactions-savepoints&gt;Tacaíonn an Django ORM agus MySQL araon (agus an InnoDB: Ref: inneall stórála `á n-úsáid agat&lt;mysql-storage-engines&gt;) le bunachar sonraí: ref: `savepoints.</p>\n<p>&lt;topics-db-transactions-savepoints&gt;Má úsáideann tú inneall stórála MyISAM bí ar an eolas faoi do thoil go bhfaighidh tú earráidí a ghintear bunachar sonraí má dhéanann tú iarracht modhanna: ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>savepoint a bhaineann leis an API idirbhearta <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>a úsáid. Is é an chúis atá leis seo ná gur oibríocht daor é inneall stórála bunachar sonraí/tábla MySQL a bhrath mar sin socraíodh nach fiú na modhanna seo a thiontú go dinimiciúil i no-op bunaithe i dtorthaí braite den sórt sin.</p>\n</section>\n<section id=\"notes-on-specific-fields\">\n<h3>Nótaí ar réimsí ar leith<a class=\"heading-anchor\" href=\"#notes-on-specific-fields\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"character-fields\">\n<span id=\"mysql-character-fields\"></span><h4>Réimsí carachtar<a class=\"heading-anchor\" href=\"#character-fields\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>D'fhéadfadh go mbeadh a “max_length” teoranta do 255 carachtar ar aon réimsí a stóráiltear le cineálacha colún <code class=\"docutils literal notranslate\">VARCHAR</code> má tá <code class=\"docutils literal notranslate\">unique=true</code> á úsáid agat don réimse. Bíonn tionchar aige seo: aicme: ~django.db.models.charfield, :class: ~django.db.models.slugfield. Féach <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>an doiciméadú MySQL <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>_ le haghaidh tuilleadh sonraí.</p>\n</section>\n<section id=\"textfield-limitations\">\n<h4>Teorainneacha <code class=\"docutils literal notranslate\">TextField</code><a class=\"heading-anchor\" href=\"#textfield-limitations\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Ní féidir le MySQL ach an chéad chars N de cholún <code class=\"docutils literal notranslate\">BLOB</code> nó TEXT` a innéacsú. Ós rud é nach bhfuil fad sainithe ag <code class=\"docutils literal notranslate\">Textfield</code>, ní féidir leat é a mharcáil mar <code class=\"docutils literal notranslate\">Unique=True</code>. Tuairiscíonn MySQL: “COLÚN BLOB/TEXT &lt;db_column&gt;'a úsáidtear i bpríomhshonraíocht gan fad eochair”.</p>\n</section>\n<section id=\"fractional-seconds-support-for-time-and-datetime-fields\">\n<span id=\"mysql-fractional-seconds\"></span><h4>Tacaíocht soicindí codánach do réimsí Am agus DátaTime<a class=\"heading-anchor\" href=\"#fractional-seconds-support-for-time-and-datetime-fields\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Is féidir le MySQL soicindí codánacha a stóráil, ar choinníoll go gcuimsíonn an sainmhíniú colún tásc codánach (m.sh. <code class=\"docutils literal notranslate\">DATETIME (6)</code>).</p>\n<p>Ní dhéanfaidh Django na colúin atá ann cheana a uasghrádú chun soicind codánacha a áireamh má thacaíonn an freastala Más mian leat iad a chumasú ar bhunachar sonraí atá ann cheana, is fútsa atá sé an colún ar an spriocbhunachar sonraí a nuashonrú de láimh, trí ordú a fhorghníomhú mar:</p>\n<div class=\"code-block\" data-language=\"sql\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">SQL</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"SQL code\"><code><span class=\"k\">ALTER</span> <span class=\"k\">TABLE</span> <span class=\"o\">`</span>your_table<span class=\"o\">`</span> <span class=\"k\">MODIFY</span> <span class=\"o\">`</span>your_datetime_column<span class=\"o\">`</span> DATETIME<span class=\"p\">(</span><span class=\"mi\">6</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>&lt;data-migrations&gt;nó ag baint úsáide as: oibríocht a:class: ~django.db.migrations.Operations.Runsql in a:ref: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>imirce sonraí <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>.</p>\n</section>\n<section id=\"timestamp-columns\">\n<h4>Colúin <code class=\"docutils literal notranslate\">TIMESTAMP</code><a class=\"heading-anchor\" href=\"#timestamp-columns\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>&lt;USE_TZ&gt;Má tá bunachar sonraí oidhreachta á úsáid agat ina bhfuil colúin <code class=\"docutils literal notranslate\">TIMESTAMP</code>, ní mór duit:setting: USE_TZ = False `a shocrú chun éilliú sonraí a sheachaint. :djadmin: Mapáil `inspectdb na colúin seo chuig:class: ~django.db.models.DateTimeField agus má chumasaíonn tú tacaíocht crios ama, déanfaidh MySQL agus Django araon iarracht na luachanna a thiontú ó UTC go am áitiúil.</p>\n</section>\n</section>\n<section id=\"row-locking-with-queryset-select-for-update\">\n<h3>Glasáil sraithe le <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>QuerySet.Select_for_Update () ``<a class=\"heading-anchor\" href=\"#row-locking-with-queryset-select-for-update\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Ní thacaíonn MySQL agus MariaDB le roinnt roghanna don <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>SELECT... LE HAGHAIDH RÁITEAS NUASHONRÚ. Má úsáidtear <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>select_for_update () <a href=\"#id5\"><span class=\"problematic\" id=\"id6\">``</span></a>le rogha gan tacaíocht, ansin ardaítear a:exc: ~django.db.notSupportedError.</p>\n<div class=\"table-scroll\" role=\"region\" tabindex=\"0\" aria-label=\"Table\"><table class=\"docutils align-default\">\n<thead>\n<tr class=\"row-odd\"><th class=\"head\"><p>Rogha</p></th>\n<th class=\"head\"><p>MariaDB</p></th>\n<th class=\"head\"><p>MySQL</p></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">SCIPEÁIL GLASÁIL</code></p></td>\n<td><p>X</p></td>\n<td><p>X</p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">NOW WAIT</code></p></td>\n<td><p>X</p></td>\n<td><p>X</p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\">OF</code></p></td>\n<td></td>\n<td><p>X</p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\">`AON EOCHR</code></p></td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n</div>\n<p>Agus tú ag úsáid <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>select_for_update () <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>ar MySQL, déan cinnte go scagann tú tacar fiosrúcháin i gcoinne sraith réimsí ar a laghad atá i srianta uathúla nó amháin i gcoinne réimsí atá clúdaithe ag innéacsanna. Seachas sin, faighfear glas scríbhneoireachta eisiach thar an tábla iomlán ar feadh ré an idirbheart.</p>\n</section>\n<section id=\"automatic-typecasting-can-cause-unexpected-results\">\n<h3>Is féidir torthaí gan choinne a bheith ina chúis le clóscáil<a class=\"heading-anchor\" href=\"#automatic-typecasting-can-cause-unexpected-results\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Agus ceist á dhéanamh agat ar chineál sreangán, ach le luach sláimhir, cuirfidh MySQL na cineálacha na luachanna go léir sa tábla a chur i gcomhar sula ndéanfaidh sé an comparáid. Má tá na luachanna <code class=\"docutils literal notranslate\">'abc'</code>, def'`` i do thábla agus má chuireann tú ceist ar <code class=\"docutils literal notranslate\">WHERE mycolumn=0</code>, meaitneoidh an dá shraith. Ar an gcaoi chéanna, meaitseálfaidh <code class=\"docutils literal notranslate\">WHERE mycolumn=1</code> an luach <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>'abc1'<a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>. Dá bhrí sin, caitheoidh réimsí cineál sreangán atá san áireamh i Django an luach chuig teaghrán i gcónaí sula n-úsáidtear é i bhfiosrú</p>\n<p>Má chuireann tú réimsí samhail saincheaptha a chuireann oidhreacht ó:class: ~Django.db.Models.Field i bhfeidhm go díreach, tá siad róthéar:meth: ~django.db.models.field.get_prep_value, nó úsáide:class: ~django.db.Models.Expressions.rawsql, :meth: ~django.db.db.s.query.queryset.extra, nó: meth: ~django.db.models.manager.raw, ba cheart duit a chinntiú go ndéanann tú cineastáil iomchuí.</p>\n</section>\n</section>\n<section id=\"sqlite-notes\">\n<span id=\"id10\"></span><h2>Nótaí SQLite<a class=\"heading-anchor\" href=\"#sqlite-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Tacaíonn Django le SQLite 3.31.0 agus níos déanaí.</p>\n<p>Soláthraíonn <a class=\"reference external\" href=\"https://www.sqlite.org/\">SQLite</a> rogha forbartha den scoth d'iarratais nach bhfuil léite amháin den chuid is mó nó a dteastaíonn lorg suiteála níos lú uathu. Mar is amhlaidh le gach freastalaithe bunachar sonraí, áfach, tá roinnt difríochtaí ann atá sonrach do SQLite ar chóir duit a bheith ar an eolas fúthu.</p>\n<section id=\"substring-matching-and-case-sensitivity\">\n<span id=\"sqlite-string-matching\"></span><h3>Meaitseáil fo-shraith agus íogaireacht<a class=\"heading-anchor\" href=\"#substring-matching-and-case-sensitivity\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>For all SQLite versions, there is some slightly counterintuitive behavior when\nattempting to match some types of strings. These are triggered when using the\n<a class=\"reference internal\" href=\"/ga/6.0/ref/models/querysets/#std-fieldlookup-iexact\"><code class=\"xref std std-lookup docutils literal notranslate\">iexact</code></a> or <a class=\"reference internal\" href=\"/ga/6.0/ref/models/querysets/#std-fieldlookup-contains\"><code class=\"xref std std-lookup docutils literal notranslate\">contains</code></a> filters in querysets. The behavior\nsplits into two cases:</p>\n<p>1. For substring matching, all matches are done case-insensitively. That is a\nfilter such as <code class=\"docutils literal notranslate\">filter(name__contains=&quot;aa&quot;)</code> will match a name of <code class=\"docutils literal notranslate\">&quot;Aabb&quot;</code>.</p>\n<p>2. For strings containing characters outside the ASCII range, all exact string\nmatches are performed case-sensitively, even when the case-insensitive options\nare passed into the query. So the <a class=\"reference internal\" href=\"/ga/6.0/ref/models/querysets/#std-fieldlookup-iexact\"><code class=\"xref std std-lookup docutils literal notranslate\">iexact</code></a> filter will behave exactly\nthe same as the <a class=\"reference internal\" href=\"/ga/6.0/ref/models/querysets/#std-fieldlookup-exact\"><code class=\"xref std std-lookup docutils literal notranslate\">exact</code></a> filter in these cases.</p>\n<p>Tá roinnt réamhshocruithe féideartha chuige seo <a class=\"reference external\" href=\"https://www.sqlite.org/faq.html#q18\">doiciméadaithe ag sqlite.org</a>, ach ní úsáideann an cúltaca réamhshocraithe SQLite i Django iad, mar bheadh sé deacair measartha iad a ionchorprú go láidir. Dá bhrí sin, nochtann Django an t-iompar réamhshocraithe SQLite agus ba chóir duit a bheith ar an eolas faoi seo agus tú ag déanamh scagadh cás-neamh-íogair nó fo-string.</p>\n</section>\n<section id=\"decimal-handling\">\n<span id=\"sqlite-decimal-handling\"></span><h3>Láimhseáil deach<a class=\"heading-anchor\" href=\"#decimal-handling\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Níl aon chineál inmheánach dáiríre deachúil ag SQLite. Déantar luachanna deachúla a thiontú go hinmheánach go dtí an cineál sonraí REAL` (uimhir phointe snámh IEEE 8-bheart), mar a mhínítear sa doiciméadú <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>SQLite datatypees' __, ionas nach dtacaíonn siad le huimhríocht snámphointe deachúil cruinn i gceart.</p>\n</section>\n<section id=\"database-is-locked-errors\">\n<h3>Earráidí “Tá bunachar sonraí faoi ghlas”<a class=\"heading-anchor\" href=\"#database-is-locked-errors\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Tá sé i gceist gur bunachar sonraí éadrom é SQLite, agus dá bhrí sin ní féidir leis tacú le leibhéal ard comhréireachta. <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>OperationalError: tá bunachar sonraí faoi ghlas <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>léiríonn earráidí go bhfuil níos mó comhréireachta ag d'iarratas ná mar is féidir le sqlite a láimhseáil i gcumraíocht réamhshocraithe. Ciallaíonn an earráid seo go bhfuil glas eisiach ag snáithe nó próiseas amháin ar nasc an bhunachar sonraí agus snáithe eile amuigh amach ag fanacht go scaoilfear an glas.</p>\n<p>Tá luach ama réamhshocraithe ag fillteán SQLite Python a chinneann cé chomh fada agus a cheadaítear don dara snáithe fanacht ar an glas sula n-aimsíonn sé amach agus ardaíonn sé an earráid <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>OperationalError: bunachar sonraí faoi ghlas <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>.</p>\n<p>Má tá an earráid seo á fháil agat, is féidir leat é a réiteach trí:</p>\n<ul>\n<li><p>Aistriú go cúltaca bunachar sonraí eile. Ag pointe áirithe éiríonn SQLite ró-“ lite” d'fheidhmchláir an domhain fíor, agus léiríonn na cineálacha earráidí comhréireachta seo gur shroich tú an pointe sin.</p></li>\n<li><p>Do chód a athscríobh chun comhréireacht a laghdú agus a chinntiú go bhfuil idirbhearta bunachar sonraí gearrré.</p></li>\n<li><p>Méadaigh an luach ama réamhshocraithe tríd an rogha bunachar sonraí <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>timeout` a shocrú:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"c1\"># ...</span>\n    <span class=\"s2\">&quot;timeout&quot;</span><span class=\"p\">:</span> <span class=\"mi\">20</span><span class=\"p\">,</span>\n    <span class=\"c1\"># ...</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Cuirfidh sé seo ar SQLite fanacht beagán níos faide sula gcaitheann sé earráidí “tá bunachar sonraí faoi ghlas”; ní dhéanfaidh sé aon rud i ndáiríre chun iad a réiteach.</p>\n</li>\n</ul>\n<section id=\"transactions-behavior\">\n<span id=\"sqlite-transaction-behavior\"></span><h4>Iompar idirbhearta<a class=\"heading-anchor\" href=\"#transactions-behavior\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Tacaíonn SQLite le trí mhodh idirbheart: <code class=\"docutils literal notranslate\">DIFRÉAD</code>, IMMEDIATE`, agus <code class=\"docutils literal notranslate\">EXCLUSIVE</code>.</p>\n<p>Is é an réamhshocraithe ná <code class=\"docutils literal notranslate\">FERRED</code>. Más gá duit modh difriúil a úsáid, socraigh é sa chuid:SETTING: OPTIONS de do chumraíocht bunachar sonraí in:setting: DATABASES, mar shampla:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"c1\"># ...</span>\n    <span class=\"s2\">&quot;transaction_mode&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;IMMEDIATE&quot;</span><span class=\"p\">,</span>\n    <span class=\"c1\"># ...</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Chun a chinntiú go fanann d'idirbhearta go dtí go n-ardóidh tú “Timeout” sula ndéantar “Bunachar Sonraí faoi ghlas”, athraigh an modh idirbheart go <code class=\"docutils literal notranslate\">IMREACHTA</code>.</p>\n<p>Chun an fheidhmíocht is fearr le IMMEDIATE` agus <code class=\"docutils literal notranslate\">EXCLUSIVE</code>, ba chóir go mbeadh idirbhearta chomh gearr agus is féidir. B'fhéidir go mbeadh sé deacair é seo a ráthú do chuid tuairimí go léir mar sin díspreagtar úsáid:setting: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>ATOMIC_REQUESTS &lt;DATABASE-ATOMIC_REQUESTS&gt;`sa chás seo.</p>\n<p>Le haghaidh tuilleadh faisnéise féach <a class=\"reference external\" href=\"https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions\">Idirbhearta i SQLite</a>.</p>\n</section>\n</section>\n<section id=\"queryset-select-for-update-not-supported\">\n<h3><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>QuerySet.Select_for_Update () <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>níl tacaíocht<a class=\"heading-anchor\" href=\"#queryset-select-for-update-not-supported\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Ní thacaíonn SQLite leis an <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>SELECT... LE HAGHAIDH COMHRÉIR A NUASHONRÚ. Ní bheidh aon éifeacht ag glaoch air.</p>\n</section>\n<section id=\"isolation-when-using-queryset-iterator\">\n<span id=\"sqlite-isolation\"></span><h3>Lionadh agus tú ag úsáid <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>QuerySet.iterator () ``<a class=\"heading-anchor\" href=\"#isolation-when-using-queryset-iterator\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Tá breithnithe speisialta ann a thuairiscítear in <a class=\"reference external\" href=\"https://www.sqlite.org/isolation.html\">Isolation In SQLite</a> agus tábla á mhodhnú agus tú ag athrú air ag baint úsáide as: meth: .querySet.iterator. Má chuirtear sraith leis, a athraítear nó a scriosadh laistigh den lúb, ansin d'fhéadfadh nó nach mbeadh an tsraith sin le feiceáil, nó d'fhéadfadh sé a bheith le feiceáil faoi dhó, i dtorthaí ina dhiaidh sin a fhaightear ón iterator. Caithfidh do chód é seo a láimhseáil.</p>\n</section>\n<section id=\"enabling-json1-extension-on-sqlite\">\n<span id=\"sqlite-json1\"></span><h3>Síneadh JSON1 a chumasú ar SQLite<a class=\"heading-anchor\" href=\"#enabling-json1-extension-on-sqlite\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>To use <a class=\"reference internal\" href=\"/ga/6.0/ref/models/fields/#django.db.models.JSONField\" title=\"django.db.models.JSONField\"><code class=\"xref py py-class docutils literal notranslate\">JSONField</code></a> on SQLite, you need to enable the\n<a class=\"reference external\" href=\"https://www.sqlite.org/json1.html\">JSON1 extension</a> on Python's <a class=\"reference external\" href=\"https://docs.python.org/3/library/sqlite3.html#module-sqlite3\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">sqlite3</code></a> library. If the extension is\nnot enabled on your installation, a system error (<code class=\"docutils literal notranslate\">fields.E180</code>) will be\nraised.</p>\n<p>Chun an síneadh JSON1 a chumasú is féidir leat an treoir a leanúint ar <a class=\"reference external\" href=\"https://code.djangoproject.com/wiki/JSON1Extension\">an leathanach wiki</a>.</p>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>Tá an síneadh JSON1 cumasaithe de réir réamhshocraithe ar SQLite 3.38+.</p>\n</aside>\n</section>\n<section id=\"setting-pragma-options\">\n<span id=\"sqlite-init-command\"></span><h3>Roghanna pragma a shocrú<a class=\"heading-anchor\" href=\"#setting-pragma-options\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Is féidir Pragma roghanna `_ a shocrú ar nasc tríd an ``init_command ``a úsáid sa chuid: setting: `OPTIONS de chumraíocht do bhunachar sonraí in:setting: DATABASES. Taispeánann an sampla thíos conas marthanacht bhreise na scríbhneoireachtaí sioncrónach a chumasú agus an cache_size` a athrú:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.sqlite3&quot;</span><span class=\"p\">,</span>\n        <span class=\"c1\"># ...</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;init_command&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;PRAGMA synchronous=3; PRAGMA cache_size=2000;&quot;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n</section>\n</section>\n<section id=\"oracle-notes\">\n<span id=\"id12\"></span><h2>Nótaí Oracle<a class=\"heading-anchor\" href=\"#oracle-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django supports <a class=\"reference external\" href=\"https://www.oracle.com/\">Oracle Database Server</a> versions 19c and higher. Version\n2.3.0 or higher of the <a class=\"reference external\" href=\"https://oracle.github.io/python-oracledb/\">oracledb</a> Python driver is required.</p>\n<p>Ionas go n-oibreoidh an t-ordú python manage.py migrate`, ní mór pribhléidí a bheith ag d'úsáideoir bunachar sonraí Oracle chun na horduithe seo a leanas a reáchtáil:</p>\n<ul class=\"simple\">\n<li><p>CRUTHAIGH TÁBLA</p></li>\n<li><p>SEICHEAMH A CHRUTHÚ</p></li>\n<li><p>CRUTHÚ NÓS IMEACHTA</p></li>\n<li><p>CRUTHAIGH TRUICEAR</p></li>\n</ul>\n<p>Chun sraith tástála tionscadail a reáchtáil, de ghnáth teastaíonn na pribhléidí* breiseanna* seo ón úsáideoir</p>\n<ul class=\"simple\">\n<li><p>CRUTHAIGH ÚSÁIDEOIR</p></li>\n<li><p>ATHRAIGH ÚSÁIDEOIR</p></li>\n<li><p>SCAOIL ÚSÁIDEOIR</p></li>\n<li><p>CRUTHAIGH SPÁS TÁBLA</p></li>\n<li><p>SPÁS TÁBLA TITIM</p></li>\n<li><p>CRUTHAIGH SEISIÚN LE ROGHA RIARACHÁIN</p></li>\n<li><p>CRUTHAIGH TÁBLA LE ROGHA RIARACHÁIN</p></li>\n<li><p>CRUTHAIGH SEICHEAMH LE ROGHA RIARACHÁIN</p></li>\n<li><p>CRUTHAIGH NÓS IMEACHTA LE ROGHA RIARACHÁIN</p></li>\n<li><p>CRUTHAIGH TRUICEAR LE ROGHA RIARACHÁIN</p></li>\n</ul>\n<p>Cé go bhfuil na pribhléidí riachtanacha <code class=\"docutils literal notranslate\">CREATE TABLE</code>, CREATE SEQUENCE`, CREATE PROCESURE`, agus CREATE TRIGGER`, agus is féidir le húsáideoir deonaithe RESOURCE WITH ADMIN OPTION` a dheonú <code class=\"docutils literal notranslate\">ACMHAIN</code>, ní féidir le húsáideoir den sórt sin na pribhléidí aonair a dheonú (m.sh. CREATE TABLE`), agus dá bhrí sin RESOURCE WITH ADMIN OPTION` Ní leor <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>de ghnáth chun tástálacha a reáchtáil.</p>\n<p>Cruthaíonn roinnt sraith tástála tuairimí nó tuairimí ábhartha freisin; chun iad seo a reáchtáil, teastaíonn pribhléidí “CREATE VIEW WITH ADMIN ROGHA” agus <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>CRUTHAIGH AMHARC ÁIRITHE LE ROGHA ADMIN <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>ag an úsáideoir freisin. Go háirithe, tá sé seo ag teastáil le haghaidh sraith tástála Django féin.</p>\n<p>Tá na pribhléidí seo go léir san áireamh sa ról DBA, atá oiriúnach le húsáid ar bhunachar sonraí forbróra príobháideach.</p>\n<p>Úsáideann cúltaca bunachar sonraí Oracle na pacáistí <code class=\"docutils literal notranslate\">SYS.DBMS_LOB</code> agus SYS.DBMS_RANDOM`, mar sin beidh ceadanna forghníomhaithe ag teastáil ó úsáideoir. De ghnáth bíonn sé inrochtana do gach úsáideoir de réir réamhshocraithe, ach i gcás nach bhfuil, beidh ort ceadanna mar sin a dheonú:</p>\n<div class=\"code-block\" data-language=\"sql\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">SQL</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"SQL code\"><code><span class=\"k\">GRANT</span> <span class=\"k\">EXECUTE</span> <span class=\"k\">ON</span> SYS<span class=\"p\">.</span>DBMS_LOB <span class=\"k\">TO</span> <span class=\"k\">user</span><span class=\"p\">;</span>\n<span class=\"k\">GRANT</span> <span class=\"k\">EXECUTE</span> <span class=\"k\">ON</span> SYS<span class=\"p\">.</span>DBMS_RANDOM <span class=\"k\">TO</span> <span class=\"k\">user</span><span class=\"p\">;</span>\n</code></pre></div>\n<section id=\"id13\">\n<h3>Ceangal leis an mbunachar sonraí<a class=\"heading-anchor\" href=\"#id13\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Chun nascadh ag baint úsáide as ainm seirbhíse do bhunachar sonraí Oracle, ba chóir go mbeadh cuma mar seo ar do chomhad <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>settings.py`:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.oracle&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;NAME&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;xe&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;USER&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;a_user&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;PASSWORD&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;a_password&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;HOST&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;PORT&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;&quot;</span><span class=\"p\">,</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Sa chás seo, ba chóir duit an bheirt: setting: HOST agus:setting: PORT a fhágáil folamh. Mar sin féin, mura n-úsáideann tú comhad <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>tnsnames.ora <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>nó modh ainmniúcháin den chineál céanna agus mura dteastaíonn uait nascadh ag baint úsáide as an SID (“xe” sa sampla seo), ansin líon isteach an bheath:setting: HOST agus:setting: PORT mar sin:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.oracle&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;NAME&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;xe&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;USER&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;a_user&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;PASSWORD&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;a_password&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;HOST&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;dbprod01ned.mycompany.com&quot;</span><span class=\"p\">,</span>\n        <span class=\"s2\">&quot;PORT&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;1540&quot;</span><span class=\"p\">,</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Ba chóir duit an dá cheann: setting: HOST agus:setting: PORT a sholáthar, nó an dá cheann a fhágáil mar theagáin folamh. Úsáidfidh Django tuairiscí ceangail difriúil ag brath ar an rogha sin.</p>\n<section id=\"full-dsn-and-easy-connect\">\n<h4>DSN Iomlán agus Easy Connect<a class=\"heading-anchor\" href=\"#full-dsn-and-easy-connect\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Is féidir teaghrán Iomlán DSN nó Easy Connect a úsáid in:socrú: AINM má tá an bheirt: socrú: HOST agus: socrú: PORT `folamh. Tá an fhormáid seo ag teastáil nuair a úsáidtear RAC nó bunachair sonraí inphlugáilte gan ``tnsnames.ora `, mar shampla.</p>\n<p>Sampla de shreang Easy Connect:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"s2\">&quot;NAME&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;localhost:1521/orclpdb1&quot;</span>\n</code></pre></div>\n<p>Sampla de shreang iomlán DSN:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"s2\">&quot;NAME&quot;</span><span class=\"p\">:</span> <span class=\"p\">(</span>\n    <span class=\"s2\">&quot;(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))&quot;</span>\n    <span class=\"s2\">&quot;(CONNECT_DATA=(SERVICE_NAME=orclpdb1)))&quot;</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n</section>\n<section id=\"oracle-pool\">\n<span id=\"id14\"></span><h3>Linn snámha nasc<a class=\"heading-anchor\" href=\"#oracle-pool\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<aside class=\"version-note version-added\" data-version=\"5.2\" role=\"note\">\n<p class=\"version-note-title\">New in Django 5.2</p></aside>\n<p>To use a connection pool with <a class=\"reference external\" href=\"https://oracle.github.io/python-oracledb/\">oracledb</a>, set <code class=\"docutils literal notranslate\">&quot;pool&quot;</code> to <code class=\"docutils literal notranslate\">True</code> in the\n<a class=\"reference internal\" href=\"/ga/6.0/ref/settings/#std-setting-OPTIONS\"><code class=\"xref std std-setting docutils literal notranslate\">OPTIONS</code></a> part of your database configuration. This uses the driver's\n<a class=\"reference external\" href=\"https://python-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#connection-pooling\">create_pool()</a> default values:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.oracle&quot;</span><span class=\"p\">,</span>\n        <span class=\"c1\"># ...</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;pool&quot;</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>To pass custom parameters to the driver's <a class=\"reference external\" href=\"https://python-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#connection-pooling\">create_pool()</a>  function, you can\nalternatively set <code class=\"docutils literal notranslate\">&quot;pool&quot;</code> to be a dict:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;django.db.backends.oracle&quot;</span><span class=\"p\">,</span>\n        <span class=\"c1\"># ...</span>\n        <span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s2\">&quot;pool&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n                <span class=\"s2\">&quot;min&quot;</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span>\n                <span class=\"s2\">&quot;max&quot;</span><span class=\"p\">:</span> <span class=\"mi\">10</span><span class=\"p\">,</span>\n                <span class=\"c1\"># ...</span>\n            <span class=\"p\">}</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n</section>\n<section id=\"insert-returning-into\">\n<h3>CUIR ISTEACH... AG FILLEADH ISTEACH<a class=\"heading-anchor\" href=\"#insert-returning-into\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>By default, the Oracle backend uses a <code class=\"docutils literal notranslate\">RETURNING INTO</code> clause to efficiently\nretrieve the value of an <code class=\"docutils literal notranslate\">AutoField</code> when inserting new rows. This behavior\nmay result in a <code class=\"docutils literal notranslate\">DatabaseError</code> in certain unusual setups, such as when\ninserting into a remote table, or into a view with an <code class=\"docutils literal notranslate\">INSTEAD OF</code> trigger.\nThe <code class=\"docutils literal notranslate\">RETURNING INTO</code> clause can be disabled by setting the\n<code class=\"docutils literal notranslate\">use_returning_into</code> option of the database configuration to <code class=\"docutils literal notranslate\">False</code>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"s2\">&quot;OPTIONS&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;use_returning_into&quot;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">,</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Sa chás seo, úsáidfidh cúltaca Oracle ceist <code class=\"docutils literal notranslate\">SELECT</code> ar leithligh chun luachanna <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>Autofield` a aisghabháil.</p>\n</section>\n<section id=\"naming-issues\">\n<h3>Saincheisteanna ainmni<a class=\"heading-anchor\" href=\"#naming-issues\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Cuireann Oracle teorainn fad ainm de 30 carachtar i bhfeidhm. Chun freastal air seo, cuireann an cúltaca aitheantóirí bunachar sonraí a fheistiú, agus luach hash MD5 in-athsheolta in ionad ceithre charachtar deiridh den ainm gearrtha. Ina theannta sin, casann an cúltaca aitheantóirí bunachar sonraí go uile-uachtaracha.</p>\n<p>Chun na claochlú seo a chosc (ní theastaíonn sé seo de ghnáth ach amháin nuair a dhéileálann tú le bunachair sonraí oidhreachta nó rochtain a fháil ar tháblaí a bhaineann le húsáideoirí eile), bain úsáid as ainm luaite mar luach do db_table`:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">class</span> <span class=\"nc\">LegacyModel</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    <span class=\"k\">class</span> <span class=\"nc\">Meta</span><span class=\"p\">:</span>\n        db_table <span class=\"o\">=</span> <span class=\"s1\">&#39;&quot;name_left_in_lowercase&quot;&#39;</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">ForeignModel</span><span class=\"p\">(</span>models<span class=\"o\">.</span>Model<span class=\"p\">):</span>\n    <span class=\"k\">class</span> <span class=\"nc\">Meta</span><span class=\"p\">:</span>\n        db_table <span class=\"o\">=</span> <span class=\"s1\">&#39;&quot;OTHER_USER&quot;.&quot;NAME_ONLY_SEEMS_OVER_30&quot;&#39;</span>\n</code></pre></div>\n<p>Is féidir ainmneacha luaite a úsáid freisin le cúltaca bunachar sonraí tacaithe eile Django; seachas Oracle, áfach, níl aon éifeacht ag na luachana.</p>\n<p>When running <code class=\"docutils literal notranslate\">migrate</code>, an <code class=\"docutils literal notranslate\">ORA-06552</code> error may be encountered if\ncertain Oracle keywords are used as the name of a model field or the\nvalue of a <code class=\"docutils literal notranslate\">db_column</code> option. Django quotes all identifiers used\nin queries to prevent most such problems, but this error can still\noccur when an Oracle datatype is used as a column name. In\nparticular, take care to avoid using the names <code class=\"docutils literal notranslate\">date</code>,\n<code class=\"docutils literal notranslate\">timestamp</code>, <code class=\"docutils literal notranslate\">number</code> or <code class=\"docutils literal notranslate\">float</code> as a field name.</p>\n</section>\n<section id=\"null-and-empty-strings\">\n<span id=\"oracle-null-empty-strings\"></span><h3>NULL agus teaghráin folamh<a class=\"heading-anchor\" href=\"#null-and-empty-strings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Is fearr le Django go ginearálta an teaghrán folamh a úsáid seachas <code class=\"docutils literal notranslate\">NULL</code>, ach déileálann Oracle leis an dá rud céanna. Chun timpeall air seo, déanann cúltaca Oracle neamhaird ar rogha sainráite <code class=\"docutils literal notranslate\">null</code> ar réimsí a bhfuil an teaghrán folamh acu mar luach féideartha agus a ghineann DDL amhail is dá mba <code class=\"docutils literal notranslate\">Null = True</code>. Nuair a bhfaightear ón mbunachar sonraí, glactar leis go gciallaíonn luach <code class=\"docutils literal notranslate\">NULL</code> i gceann de na réimsí seo an sreang folamh i ndáiríre, agus déantar na sonraí a thiontú go ciúin chun an toimhde seo a léiriú.</p>\n</section>\n<section id=\"id15\">\n<h3>Teorainneacha <code class=\"docutils literal notranslate\">TextField</code><a class=\"heading-anchor\" href=\"#id15\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The Oracle backend stores each <code class=\"docutils literal notranslate\">TextField</code> as an <code class=\"docutils literal notranslate\">NCLOB</code> column. Oracle\nimposes some limitations on the usage of such LOB columns in general:</p>\n<ul class=\"simple\">\n<li><p>Ní féidir colúin LOB a úsáid mar eochracha príomhúil.</p></li>\n<li><p>Ní féidir colúin LOB a úsáid in innéacsanna.</p></li>\n<li><p>Ní féidir colúin LOB a úsáid i liosta <code class=\"docutils literal notranslate\">SELECT DISTINCT</code>. Ciallaíonn sé seo go mbeidh earráid <code class=\"docutils literal notranslate\">ORA-00932` mar thoradh ar iarracht an modh ``QuerySet.Distinct' a úsáid ar mhúnla a chuimsíonn colúin ``TextField</code> mar thoradh ar earráid <code class=\"docutils literal notranslate\">ORA-00932` nuair a bheidh á reáchtáil i gcoinne Oracle. Mar réiteach, bain úsáid as an modh ``QuerySet.defer</code> i gcomhar le <code class=\"docutils literal notranslate\">different () ``chun cosc a chur ar cholúin ``TextField</code> a chur san áireamh sa liosta <code class=\"docutils literal notranslate\">SELECT DISTINCT</code>.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"subclassing-the-built-in-database-backends\">\n<span id=\"subclassing-database-backends\"></span><h2>Fo-aicmiú na gcúltaca bunachar sonraí ionsuite<a class=\"heading-anchor\" href=\"#subclassing-the-built-in-database-backends\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django comes with built-in database backends. You may subclass an existing\ndatabase backend to modify its behavior, features, or configuration.</p>\n<p>Smaoinigh, mar shampla, go gcaithfidh tú gné bunachar sonraí amháin a athrú. Ar dtús, caithfidh tú eolaire nua a chruthú le modúl <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>base <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>ann. Mar shampla:</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Text code\"><code>mysite/\n    ...\n    mydbengine/\n        __init__.py\n        base.py\n</code></pre></div>\n<p>Caithfidh rang darb ainm <code class=\"docutils literal notranslate\">DatabaseWrapper</code> a bheith sa mhodúl <code class=\"docutils literal notranslate\">base.py</code> a fho-aicmíonn inneall atá ann cheana ón modúl <code class=\"docutils literal notranslate\">django.db.backends</code>. Seo sampla de fho-aicmiú an inneall PostgreSQL chun aicme gné allows_group_by_selected_pks_on_model` a athrú:</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"python\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\">mysite/mydbengine/base.py</code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.db.backends.postgresql</span> <span class=\"kn\">import</span> base<span class=\"p\">,</span> features\n\n\n<span class=\"k\">class</span> <span class=\"nc\">DatabaseFeatures</span><span class=\"p\">(</span>features<span class=\"o\">.</span>DatabaseFeatures<span class=\"p\">):</span>\n    <span class=\"k\">def</span> <span class=\"nf\">allows_group_by_selected_pks_on_model</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> model<span class=\"p\">):</span>\n        <span class=\"k\">return</span> <span class=\"kc\">True</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">DatabaseWrapper</span><span class=\"p\">(</span>base<span class=\"o\">.</span>DatabaseWrapper<span class=\"p\">):</span>\n    features_class <span class=\"o\">=</span> DatabaseFeatures\n</code></pre></figure>\n<p>Faoi dheireadh, ní mór duit a: setting: DATABASE-ENGINE a shonrú i do chomhad <code class=\"docutils literal notranslate\">settings.py</code>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>DATABASES <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s2\">&quot;default&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s2\">&quot;ENGINE&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;mydbengine&quot;</span><span class=\"p\">,</span>\n        <span class=\"c1\"># ...</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Is féidir leat an liosta reatha d'innill bunachar sonraí a fheiceáil trí fhéachaint isteach: source: django/db/backends.</p>\n</section>\n<section id=\"using-a-3rd-party-database-backend\">\n<span id=\"third-party-notes\"></span><h2>Úsáid cúltaca bunachar sonraí 3ú páirtí<a class=\"heading-anchor\" href=\"#using-a-3rd-party-database-backend\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Chomh maith leis na bunachair sonraí a thacaítear go hoifigiúil, tá cúltaca ann a sholáthraíonn tríú páirtithe a ligeann duit bunachair sonraí eile a úsáid le Django:</p>\n<ul class=\"simple\">\n<li><p>&lt;django-cockroachdb&gt;:pypi: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>CockroachDB `</p></li>\n<li><p>&lt;django-firebird&gt;:pypi: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>Bird dóiteáin `</p></li>\n<li><p>&lt;django-google-spanner&gt;:pypi: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>Google Cloud Spanner `</p></li>\n<li><p>&lt;mssql-django&gt;:pypi: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>Freastalaí SQL Microsoft `</p></li>\n<li><p><a class=\"extlink-pypi reference external\" href=\"https://pypi.org/project/django-mongodb-backend/\">MongoDB</a></p></li>\n<li><p>&lt;django-snowflake&gt;:pypi: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>Snowflake `</p></li>\n<li><p>&lt;django-tidb&gt;:pypi: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>TiDB `</p></li>\n<li><p>&lt;django-yugabytedb&gt;:pypi: <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>YugabyteDB `</p></li>\n</ul>\n<p>Tá athrú mór ag leaganacha Django agus gnéithe ORM a thacaíonn na cúltaca neamhfhoifigiúla seo. Ba cheart ceisteanna maidir le cumais shonracha na gcúltaca neamhoifigiúla seo, mar aon le haon cheisteanna tacaíochta, a threorú chuig na bealaí tacaíochta a sholáthraíonn gach tionscadal tríú</p>\n</section>","rootId":"databases","toc":[{"title":"Nótaí ginearálta","anchor":"general-notes","children":[{"title":"Naisc leanúnacha","anchor":"persistent-connections","children":[{"title":"Bainistíocht nasc","anchor":"connection-management","children":[]},{"title":"Rabhadh","anchor":"caveats","children":[]}]},{"title":"Ionchódú","anchor":"encoding","children":[]}]},{"title":"Nótaí PostgreSQL","anchor":"postgresql-notes","children":[{"title":"Socruithe nasc PostgreSQL","anchor":"postgresql-connection-settings","children":[]},{"title":"Cumraíocht PostgreSQL a bharrfheabhsú","anchor":"optimizing-postgresql-s-configuration","children":[]},{"title":"Leibhéal aonrú","anchor":"isolation-level","children":[]},{"title":"Ról","anchor":"role","children":[]},{"title":"Linn snámha nasc","anchor":"connection-pool","children":[]},{"title":"Paraiméadair taobh an fhreastalaí","anchor":"server-side-parameters-binding","children":[]},{"title":"Innéacsanna do cholúin varchar agus text","anchor":"indexes-for-varchar-and-text-columns","children":[]},{"title":"Oibríocht imirce chun síntí a chur","anchor":"migration-operation-for-adding-extensions","children":[]},{"title":"Cúrsaí taobh an fhreastalaí","anchor":"server-side-cursors","children":[{"title":"Comhdhlúthú idirbheart agus cúrsaí taobh an fhreastalaí","anchor":"transaction-pooling-and-server-side-cursors","children":[]}]},{"title":"Luachanna na n-eochracha bunscoile atá ag méadú uathoibríoch","anchor":"manually-specifying-values-of-auto-incrementing-primary-keys","children":[]},{"title":"Teimpléid bhunachar sonraí","anchor":"test-database-templates","children":[]},{"title":"Forghníomhú tástála a bhrostú le socruithe neamh-bhuan","anchor":"speeding-up-test-execution-with-non-durable-settings","children":[]}]},{"title":"Nótaí MariaDB","anchor":"mariadb-notes","children":[]},{"title":"Nótaí MySQL","anchor":"mysql-notes","children":[{"title":"Tacaíocht leagan","anchor":"version-support","children":[]},{"title":"Innill stórála","anchor":"storage-engines","children":[]},{"title":"Tiománaithe API MySQL DB","anchor":"mysql-db-api-drivers","children":[{"title":"mysqlclient","anchor":"mysqlclient","children":[]},{"title":"Ceanglóir MySQL/Python","anchor":"id8","children":[]}]},{"title":"Sainmhínithe crios ama","anchor":"time-zone-definitions","children":[]},{"title":"Cruthú do bhunachar sonraí","anchor":"creating-your-database","children":[{"title":"Socruithe coláireachta","anchor":"collation-settings","children":[]}]},{"title":"Ceangal leis an mbunachar sonraí","anchor":"connecting-to-the-database","children":[{"title":"Socrú sql_mode","anchor":"setting-sql-mode","children":[]},{"title":"Leibhéal aonrú","anchor":"mysql-isolation-level","children":[]}]},{"title":"Do tháblaí a chruthú","anchor":"creating-your-tables","children":[]},{"title":"Ainmneacha tábla","anchor":"table-names","children":[]},{"title":"Sábháilteachta","anchor":"savepoints","children":[]},{"title":"Nótaí ar réimsí ar leith","anchor":"notes-on-specific-fields","children":[{"title":"Réimsí carachtar","anchor":"character-fields","children":[]},{"title":"Teorainneacha TextField","anchor":"textfield-limitations","children":[]},{"title":"Tacaíocht soicindí codánach do réimsí Am agus DátaTime","anchor":"fractional-seconds-support-for-time-and-datetime-fields","children":[]},{"title":"Colúin TIMESTAMP","anchor":"timestamp-columns","children":[]}]},{"title":"Glasáil sraithe le ``QuerySet.Select_for_Update () ``","anchor":"row-locking-with-queryset-select-for-update","children":[]},{"title":"Is féidir torthaí gan choinne a bheith ina chúis le clóscáil","anchor":"automatic-typecasting-can-cause-unexpected-results","children":[]}]},{"title":"Nótaí SQLite","anchor":"sqlite-notes","children":[{"title":"Meaitseáil fo-shraith agus íogaireacht","anchor":"substring-matching-and-case-sensitivity","children":[]},{"title":"Láimhseáil deach","anchor":"decimal-handling","children":[]},{"title":"Earráidí “Tá bunachar sonraí faoi ghlas”","anchor":"database-is-locked-errors","children":[{"title":"Iompar idirbhearta","anchor":"transactions-behavior","children":[]}]},{"title":"``QuerySet.Select_for_Update () ``níl tacaíocht","anchor":"queryset-select-for-update-not-supported","children":[]},{"title":"Lionadh agus tú ag úsáid ``QuerySet.iterator () ``","anchor":"isolation-when-using-queryset-iterator","children":[]},{"title":"Síneadh JSON1 a chumasú ar SQLite","anchor":"enabling-json1-extension-on-sqlite","children":[]},{"title":"Roghanna pragma a shocrú","anchor":"setting-pragma-options","children":[]}]},{"title":"Nótaí Oracle","anchor":"oracle-notes","children":[{"title":"Ceangal leis an mbunachar sonraí","anchor":"id13","children":[{"title":"DSN Iomlán agus Easy Connect","anchor":"full-dsn-and-easy-connect","children":[]}]},{"title":"Linn snámha nasc","anchor":"oracle-pool","children":[]},{"title":"CUIR ISTEACH... AG FILLEADH ISTEACH","anchor":"insert-returning-into","children":[]},{"title":"Saincheisteanna ainmni","anchor":"naming-issues","children":[]},{"title":"NULL agus teaghráin folamh","anchor":"null-and-empty-strings","children":[]},{"title":"Teorainneacha TextField","anchor":"id15","children":[]}]},{"title":"Fo-aicmiú na gcúltaca bunachar sonraí ionsuite","anchor":"subclassing-the-built-in-database-backends","children":[]},{"title":"Úsáid cúltaca bunachar sonraí 3ú páirtí","anchor":"using-a-3rd-party-database-backend","children":[]}],"breadcrumbs":[{"docname":"ref/index","title":"Tagairt API","url":"/ga/6.0/ref/"}],"prev":{"docname":"ref/csrf","title":"Iarratas ar Trasláithreán Cosaint Fholsaíochta","url":"/ga/6.0/ref/csrf/"},"next":{"docname":"ref/django-admin","title":"django-admin agus manage.py","url":"/ga/6.0/ref/django-admin/"},"formats":{"html":"/ga/6.0/ref/databases/","markdown":"/ga/6.0/ref/databases.md","json":"/ga/6.0/ref/databases.json"},"source":"https://github.com/django/django/blob/stable/6.0.x/docs/ref/databases.txt","official":"https://docs.djangoproject.com/ga/6.0/ref/databases/","inVersions":["6.1","6.0","5.2"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}