Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] base_external_dbsource_mssql: Migration to 17.0 #298

Open
wants to merge 14 commits into
base: 17.0
Choose a base branch
from

Conversation

carolinafernandez-tecnativa
Copy link

@carolinafernandez-tecnativa carolinafernandez-tecnativa commented Jul 16, 2024

  • Standard migration to v17.
  • Remove unnecessary dependany to base_external_dbsource_sqlite
  • Add dependency to base_external_dbsource
  • Update INSTALL.md

@Tecnativa
TT50002

@pedrobaeza @sergio-teruel

lasley and others added 13 commits July 24, 2024 09:13
* Heavily refactor code for reusability
* Split all sources into independent modules
* Add more test coverage
* Add CRUD methods
* Add iterator execute return to roadmap

[UPD] Update base_external_dbsource_mssql.pot
[UPD] README.rst

[UPD] Update base_external_dbsource_mssql.pot

[UPD] README.rst
[UPD] Update base_external_dbsource_mssql.pot
[UPD] Update base_external_dbsource_mssql.pot
…heel for pymssql" (OCA#196)

The new `pymssql==2.2.6` version released this weekend
  - <img width="414" alt="Screenshot 2022-11-15 at 20 11 53" src="https://user-images.githubusercontent.com/6644187/202066666-a1551d22-d50a-4c14-ae0a-dd35dc147a40.png">

requires extra setup to be installed

So, it is raising new errors where it is not setup

You can reproduce it running the following command:

    docker run -it --rm  python:3.6 pip3 install -q pymssql==2.2.6

`ERROR: Could not build wheels for pymssql...`

  ERROR: Command errored out with exit status 1:
    command: /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpmp6b33ly
        cwd: /tmp/pip-install-p4ocn1ip/pymssql_01748f191a744758bda6f7d536f6ec35
    Complete output (25 lines):
    setup.py: platform.system() => Linux
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.libc_ver() => ('glibc', '2.2.5')
    setup.py: include_dirs => []
    setup.py: library_dirs => []
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/pymssql
    copying src/pymssql/__init__.py -> build/lib.linux-x86_64-3.6/pymssql
    running build_ext
    cythoning src/pymssql/_mssql.pyx to src/pymssql/_mssql.c
    cythoning src/pymssql/_pymssql.pyx to src/pymssql/_pymssql.c
    building 'pymssql._mssql' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    creating build/temp.linux-x86_64-3.6/src/pymssql
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.6m -c src/pymssql/_mssql.c -o build/temp.linux-x86_64-3.6/src/pymssql/_mssql.o -DMSDBLIB
    src/pymssql/_mssql.c:747:10: fatal error: sqlfront.h: No such file or directory
      747 | #include "sqlfront.h"
          |          ^~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
    ERROR: Failed building wheel for pymssql
  ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly
  WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
  You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
  FAIL

However, using

    docker run -it --rm  python:3.6 pip3 install -q pymssql==2.2.5

It is installing well!

So, I have created this PR in order to fix all the error in the CI using this project and installing this package
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-backend-16.0/server-backend-16.0-base_external_dbsource_mssql
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_external_dbsource_mssql/
Currently translated at 100.0% (4 of 4 strings)

Translation: server-backend-16.0/server-backend-16.0-base_external_dbsource_mssql
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_external_dbsource_mssql/es/
Currently translated at 100.0% (4 of 4 strings)

Translation: server-backend-16.0/server-backend-16.0-base_external_dbsource_mssql
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_external_dbsource_mssql/it/
Currently translated at 100.0% (4 of 4 strings)

Translation: server-backend-16.0/server-backend-16.0-base_external_dbsource_mssql
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_external_dbsource_mssql/pt_BR/
@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 17.0-mig-base_external_dbsource_mssql branch 2 times, most recently from 8854f4b to acd8957 Compare July 24, 2024 16:25
@carolinafernandez-tecnativa
Copy link
Author

ping @sergio-teruel @pedrobaeza

@pedrobaeza
Copy link
Member

/ocabot migration base_external_dbsource_mssql

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jul 25, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Jul 25, 2024
10 tasks
<record model="base.external.dbsource" id="demo_mssql">
<field name="name">MSSQL Demo</field>
<field
name="conn_string"
>Server=myServerAddress;Database=myDataBase;User Id=myUsername;</field>
>mssql+pymssql://myUsername:%s@myServerAddress:port/myDataBase</field>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the final connection string?

@@ -1,8 +1,8 @@
# Copyright 2011 Daniel Reis
# Copyright 2016 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

# this is needed to generate connection string
import pymssql
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't do the import, isn't this working?

@@ -1,8 +1,8 @@
# Copyright 2011 Daniel Reis
# Copyright 2016 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removing the license?

return self._execute_mssql(sqlquery, sqlparams, metadata)

def _connection_open_mssql(self):
return sqlalchemy.create_engine(self.conn_string_full).connect()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not doing the computed connection string as talked?

@TheCloneMaster
Copy link

I tried this and works fine

@pedrobaeza
Copy link
Member

@sergio-teruel can you resume this?

@TheCloneMaster
Copy link

By "works fine" I mean it connects to the server, but upon closer inspection, it is half way there...
I will complete migration to pymssql and remove sqlalchemy requirement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.