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

Segmentation fault while using gsheets dialect #420

Open
tijoseymathew opened this issue Dec 28, 2023 · 2 comments
Open

Segmentation fault while using gsheets dialect #420

tijoseymathew opened this issue Dec 28, 2023 · 2 comments
Labels

Comments

@tijoseymathew
Copy link

tijoseymathew commented Dec 28, 2023

Describe the bug
I am encountering a segmentation fault when using the SQLAlchemy library with the gsheets dialect. The issue occurs when attempting to add a new record to a Google Sheets-backed database and committing the session.

To Reproduce

import uuid

from sqlalchemy import create_engine, Column, String
from sqlalchemy.orm import declarative_base, sessionmaker

engine = create_engine(
        'gsheets://',
        service_account_file="google_auth.json",
        catalog = {
            "users": (
                "https://docs.google.com/spreadsheets/d/TRUNCATED/edit?"
                "headers=1"
                "#gid=0"
                ),
            }
        )

Base = declarative_base()
class User(Base):
    __tablename__ = "users"
    id = Column(String, primary_key=True, nullable=False, autoincrement=False)
    name = Column(String)

SessionMaker = sessionmaker(bind=engine)
session = SessionMaker()
new_rec = User(id=uuid.uuid4(), name="Test")
session.add(new_rec)
session.commit()
print("DONE")

The row is successfully appended to the Google sheet.

Screenshots
image
image

Expected behavior
I expected the code to work without any segmentation faults.

Desktop:

  • OS: Ubuntu 22.04.3 LTS
  • Python libraries
    • Python 3.10.12
    • sqlalchemy-orm==1.2.10
    • SQLAlchemy==2.0.23
    • shillelagh==1.2.12
    • google-auth==2.26.2
@cwegener cwegener added the bug label Jan 2, 2024
@betodealmeida
Copy link
Owner

This is hard to debug. What architecture are you using, and what version of apsw do you have? (you can run SELECT VERSION() to see the version.)

@tijoseymathew
Copy link
Author

I tested on two machines with the following config and experienced Segmentation fault

$ lscpu | grep Architecture
Architecture:                       x86_64
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy
$ python -c "import apsw; print(apsw.apswversion())"
3.44.2.0

Do let me know if you need any other info. Thanks!

Note: I missed out 'google-auth==2.26.2' in OP, added it

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

No branches or pull requests

3 participants