[Django] #16376: [oracle] Support for database links

51 views
Skip to first unread message

Django

unread,
Jun 29, 2011, 3:39:26 PM6/29/11
to django-...@googlegroups.com
#16376: [oracle] Support for database links
----------------------------+----------------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… | Status: new
Type: New feature | Component: Database layer (models, ORM)
Milestone: | Severity: Normal
Version: 1.3 | Triage Stage: Unreviewed
Keywords: oracle | Easy pickings: 0
Has patch: 0 |
UI/UX: 0 |
----------------------------+----------------------------------------------
Currently, Oracle with Django do not support database links (see
[http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/ds_concepts002.htm
Oracle documentation])

It's used this way in SQL:
{{{
select count(*) from "MY_TABLE"@"MY_DBLINK";
}}}

With Django, I tried to passe it through the db_name
{{{
class MyObject(models.Model):
class Meta:
managed = False
db_table = u'"MY_TABLE"@"MY_DBLINK"'
}}}

However, when it comes to write sql, Django use db_table to specify the
column names. Using db link, the generated command is not valid:
{{{
SELECT "MY_TABLE"@"MY_DBLINK"."COLUMN1", "MY_TABLE"@"MY_DBLINK"."COLUMN2"
FROM "MY_TABLE"@"MY_DBLINK"
}}}

It should be:
{{{
SELECT "MY_TABLE"."COLUMN1"@"MY_DBLINK", "MY_TABLE"."COLUMN2"@"MY_DBLINK"
FROM "MY_TABLE"@"MY_DBLINK"
}}}

I think it worth to add a new db_link Meta option, eg.
{{{
class MyObject(models.Model):
class Meta:
managed = False
db_table = u'MY_TABLE'
db_link = u'MY_DBLINK'
}}}

A workaround could be to define a new database access in Django settings.
However, I guess in some cases, the remote database could be reached only
from the bridge - not directly from Django application. That's why this
options should be needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/16376>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 29, 2011, 8:15:33 PM6/29/11
to django-...@googlegroups.com
#16376: [oracle] Support for database links
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… | Status: new
Type: New | Component: Database layer
feature | (models, ORM)
Milestone: | Severity: Normal
Version: 1.3 | Keywords: oracle
Resolution: | Has patch: 0
Triage Stage: Accepted | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by russellm):

* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

See #6148 for a vaguely related ticket. Based on the documentation
provided, it also seems like there's crossover here with the feature
request for cross-database joins (documented as not being supported in
#13216)

As for the API approach, I'm not wild about the idea of adding a Meta
option for an Oracle-specific feature. It feels to me like there should be
some way to tie this to routing and the underlying database definition
(i.e., the link is a feature of the database connection, not of the table
itself)

--
Ticket URL: <https://code.djangoproject.com/ticket/16376#comment:1>

Django

unread,
Jun 30, 2011, 4:04:42 AM6/30/11
to django-...@googlegroups.com
#16376: Support for database links
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… | Status: new
Type: New | Component: Database layer
feature | (models, ORM)
Milestone: | Severity: Normal
Version: 1.3 | Keywords: oracle postgres
Resolution: | Has patch: 0
Triage Stage: Accepted | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by stephane.benchimol@…):

* keywords: oracle => oracle postgres


Comment:

After few researches, it appears this function is not only Oracle-
specific, but exists also in Postgresql (see
[http://www.postgresql.org/docs/current/static/contrib-dblink.html
Postgresql documentation]) -- and maybe more databases ?

However, with Postgres, the approach is slightly different, because it has
to encapsulate the query using ''dblink'' function, eg.
{{{
select * from dblink('dbname=MY_DBLINK', 'select count(*) from
"MY_TABLE"')
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16376#comment:2>

Django

unread,
Sep 30, 2011, 5:56:22 PM9/30/11
to django-...@googlegroups.com
#16376: Support for database links
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… | Status: new
Type: New feature | Version: 1.3
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: oracle postgres | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by ikelly):

* cc: ian.g.kelly@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16376#comment:3>

Django

unread,
Mar 26, 2012, 4:00:03 PM3/26/12
to django-...@googlegroups.com
#16376: Support for database links
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… | Status: new
Type: New feature | Version: 1.3
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: oracle postgres | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by diegobz):

* cc: diegobz (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16376#comment:4>

Django

unread,
Mar 26, 2012, 4:14:18 PM3/26/12
to django-...@googlegroups.com
#16376: Support for database links
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… | Status: new
Type: New feature | Version: 1.3
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: oracle postgres | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by akaariai):

* cc: anssi.kaariainen@… (added)


Comment:

I am currently working on #6148, and I think this could be relatively easy
to support if the #6148 work gets completed. Just another syntax for the
FROM entry.

If this gets implemented, db_link should imply managed = False.

--
Ticket URL: <https://code.djangoproject.com/ticket/16376#comment:5>

Django

unread,
Aug 27, 2016, 3:37:46 PM8/27/16
to django-...@googlegroups.com
#16376: Support for database links
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… |
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle postgres | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by auvipy):

* version: 1.3 => master


--
Ticket URL: <https://code.djangoproject.com/ticket/16376#comment:6>

Django

unread,
Mar 12, 2024, 9:57:47 AM3/12/24
to django-...@googlegroups.com
#16376: Support for database links
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
stephane.benchimol@… |
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle postgres | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/16376#comment:7>
Reply all
Reply to author
Forward
0 new messages