Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions base_external_dbsource_sap_hana/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
=====================================
External Database Source - SAP - Hana
=====================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b85a80a6fdb648c130cc6fdce284d503c8bc94a3878ddc2c51dc24f1d0764481
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
:target: https://github.com/OCA/server-backend/tree/18.0/base_external_dbsource_sap_hana
:alt: OCA/server-backend
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-backend-18-0/server-backend-18-0-base_external_dbsource_sap_hana
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends ``base_external_dbsource``, allowing you to connect
to foreign SAP HANA databases using SQLAlchemy.

**Table of contents**

.. contents::
:local:

Installation
============

To install this module, you need to:

- Install ``sqlalchemy_hana`` and ``hdbcli`` python libraries

Configuration
=============

To configure this module, you need to:

1. Database sources can be configured in Settings > Technical > Database
Structure > Database sources.

Usage
=====

To use this module:

- Go to Settings > Technical > Database Structure > Database Sources
- Click on Create to enter the following information:
- Datasource name??
- Pasword
- Connector: Choose the database to which you want to connect
- Connection string: Specify how to connect to database

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource_sap_hana%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com/>`__:

- Carlos Dauden
- Sergio Teruel

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/18.0/base_external_dbsource_sap_hana>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions base_external_dbsource_sap_hana/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions base_external_dbsource_sap_hana/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2022 Tecnativa - Sergio Teruel
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "External Database Source - SAP - Hana",
"version": "18.0.1.0.0",
"category": "Tools",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-backend",
"license": "LGPL-3",
"depends": ["base_external_dbsource"],
"external_dependencies": {"python": ["sqlalchemy", "sqlalchemy-hana", "hdbcli"]},
"demo": ["demo/base_external_dbsource.xml"],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" ?>
<odoo>
<record model="base.external.dbsource" id="demo_sap_hana">
<field name="name">SAP Hana Demo</field>
<field name="conn_string">hana://username:password@example.de:30015</field>
<field name="password">password</field>
<field name="connector">sap_hana</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_external_dbsource_sap_hana
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: base_external_dbsource_sap_hana
#: model:ir.model,name:base_external_dbsource_sap_hana.model_base_external_dbsource
msgid "External Database Sources"
msgstr ""
22 changes: 22 additions & 0 deletions base_external_dbsource_sap_hana/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_external_dbsource_sap_hana
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-09 07:49+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: base_external_dbsource_sap_hana
#: model:ir.model,name:base_external_dbsource_sap_hana.model_base_external_dbsource
msgid "External Database Sources"
msgstr "Fuentes de bases de datos externas"
22 changes: 22 additions & 0 deletions base_external_dbsource_sap_hana/i18n/gl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_external_dbsource_sap_hana
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-05-23 07:54+0000\n"
"Last-Translator: Pablo Castelo <pablocv@gmx.es>\n"
"Language-Team: none\n"
"Language: gl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: base_external_dbsource_sap_hana
#: model:ir.model,name:base_external_dbsource_sap_hana.model_base_external_dbsource
msgid "External Database Sources"
msgstr "Fuentes de bases de datos externas"
1 change: 1 addition & 0 deletions base_external_dbsource_sap_hana/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import base_external_dbsource
38 changes: 38 additions & 0 deletions base_external_dbsource_sap_hana/models/base_external_dbsource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2022 Tecnativa - Sergio Teruel
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).


import sqlalchemy

from odoo import fields, models


class BaseExternalDbsource(models.Model):
"""It provides logic for connection to a SAP Hana data source."""

_inherit = "base.external.dbsource"

connector = fields.Selection(
selection_add=[("sap_hana", "SAP-Hana")],
ondelete={"sap_hana": "cascade"},
)

def connection_close_sap_hana(self, connection):
return connection.close()

def connection_open_sap_hana(self):
return sqlalchemy.create_engine(self.conn_string_full).connect()

def execute_sap_hana(self, sqlquery, sqlparams, metadata):
# FIXME: Duplicated method in modules to be consolidated in base
rows, cols = list(), list()
for record in self:
with record.connection_open() as connection:
if sqlparams is None:
cur = connection.execute(sqlquery)
else:
cur = connection.execute(sqlquery, sqlparams)
if metadata:
cols = list(cur.keys())
rows = [r for r in cur]
return rows, cols
3 changes: 3 additions & 0 deletions base_external_dbsource_sap_hana/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions base_external_dbsource_sap_hana/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To configure this module, you need to:

1. Database sources can be configured in Settings \> Technical \>
Database Structure \> Database sources.
3 changes: 3 additions & 0 deletions base_external_dbsource_sap_hana/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [Tecnativa](https://www.tecnativa.com/):
- Carlos Dauden
- Sergio Teruel
2 changes: 2 additions & 0 deletions base_external_dbsource_sap_hana/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends `base_external_dbsource`, allowing you to connect to
foreign SAP HANA databases using SQLAlchemy.
3 changes: 3 additions & 0 deletions base_external_dbsource_sap_hana/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To install this module, you need to:

- Install `sqlalchemy_hana` and `hdbcli` python libraries
8 changes: 8 additions & 0 deletions base_external_dbsource_sap_hana/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To use this module:

- Go to Settings \> Technical \> Database Structure \> Database Sources
- Click on Create to enter the following information:
- Datasource name??
- Pasword
- Connector: Choose the database to which you want to connect
- Connection string: Specify how to connect to database
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading