BuzzCutNorman / tap-mssql

Singer Tap for MS SQL built with Meltano Singer SDK.
MIT License
2 stars 9 forks source link

Meltano Tap-mssql error on MAC #75

Open ChakaMusonza opened 5 months ago

ChakaMusonza commented 5 months ago

I am experiencing an issue when using the tap-mssql extractor. error message: Plugin configuration is invalid Catalog discovery failed: command ['/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/bin/tap-mssql', '--config', '/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/run/tap-mssql/tap.35a8eba3-6241-4fb7-b258-8e1761b738a5.config.json', '--discover'] returned 1 with stderr: Traceback (most recent call last): File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/bin/tap-mssql", line 8, in sys.exit(Tapmssql.cli()) ^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/click/core.py", line 1157, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/click/core.py", line 1077, in main with self.make_context(prog_name, args, extra) as ctx: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/click/core.py", line 943, in make_context self.parse_args(ctx, args) File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/click/core.py", line 1408, in parse_args value, args = param.handle_parse_result(ctx, opts, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/click/core.py", line 2400, in handle_parse_result value = self.process_value(ctx, value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/click/core.py", line 2362, in process_value value = self.callback(ctx, self, value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/singer_sdk/tap_base.py", line 540, in cb_discover tap.run_discovery() File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/singer_sdk/tap_base.py", line 295, in run_discovery catalog_text = self.catalog_json_text ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/singer_sdk/tap_base.py", line 315, in catalog_json_text return json.dumps(self.catalog_dict, indent=2) ^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/singer_sdk/tap_base.py", line 681, in catalog_dict result["streams"].extend(connector.discover_catalog_entries()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/singer_sdk/connectors/sql.py", line 513, in discover_catalog_entries engine = self._engine ^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/singer_sdk/connectors/sql.py", line 309, in _engine self._cached_engine = self.create_engine() ^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/tap_mssql/client.py", line 92, in create_engine return sa.engine_from_config(eng_config, prefix=eng_prefix) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 820, in engine_from_config return create_engine(url, *options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 2, in create_engine File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/sqlalchemy/util/deprecations.py", line 281, in warned return fn(args, kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 599, in create_engine dbapi = dbapi_meth(dbapi_args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/sqlalchemy/dialects/mssql/pymssql.py", line 65, in import_dbapi module = import("pymssql") ^^^^^^^^^^^^^^^^^^^^^ File "/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/pymssql/init.py", line 3, in from ._pymssql import * File "src/pymssql/_pymssql.pyx", line 1, in init pymssql._pymssql ImportError: dlopen(/Users/chakamusonza/Desktop/Meltano/.venv/my-meltano-second-project/my-meltano-project/.meltano/extractors/tap-mssql/venv/lib/python3.12/site-packages/pymssql/_mssql.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_bcp_batch'

BuzzCutNorman commented 5 months ago

ChakaMusonza, Sorry to hear you have run into an issue using tap-mssql. Looking at the trace back you provided I believe the this is a known issue with pymssql. A Mac user with a M3 chip filed the below issue in April 2024 and a workaround was added 3 weeks ago:

https://github.com/pymssql/pymssql/issues/891

Disclosure I am guessing 100 percent here. Looking at the workaround you could install freetds via brew, add the environment variables (???), and in your project run meltano install --clean. Like I said 100% guess.

The other option you have is to give pyodbc a try. You will need to install the MS ODBC driver before doing so.

https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver16

There are also some tap-mssql pyodbc specific settings you will need to set. You can find examples of those in the tap-mssql readme.

Good luck and let me know what does or doesn't work for you. That way I can update the tap-mssql troubleshooting section.