liv2hak
liv2hak

Reputation: 14970

sqlalchemy OperationalError: (OperationalError) unable to open database file None None

I am trying to create a database in a remote system.The relevant code is given below

log = core.getLogger()

engine = create_engine('sqlite:////name:[email protected]/tmp/nwtopology.db',echo=False)
Base = declarative_base()
Session = sessionmaker(bind=engine)
session = Session()

class SourcetoPort(Base):
    """"""
    __tablename__ = 'source_to_port'
    id = Column(Integer, primary_key=True)
    port_no        = Column(Integer)
    src_address    = Column(String,index=True)

    #-----------------------------------------
    def __init__(self, src_address,port_no):
        """"""
        self.src_address = src_address
        self.port_no     = port_no

Obviously I am trying to create the database in a remote system. I am getting the error:

OperationalError: (OperationalError) unable to open database file None None

My questions are as follows.

1) the user that is running the program on local machine is not the same as the user that is trying to create the database on the remote machine.Is this an issue?

2) Are there any mechanisms to improve the latency of inserting an entry into the database and querying and entry by creating a local cached copy?

Regards, Karthik.

Upvotes: 2

Views: 2762

Answers (3)

According to this, you can use this notation:

engine = create_engine('sqlite:///\\\\192.168.129.139\\tmp\\nwtopology.db',echo=False)

Still do not know how to pass the network credentials, but at least you can access remote files that way. It worked for me.

Upvotes: 0

vvladymyrov
vvladymyrov

Reputation: 5793

Please see my answer with details explanations to your other related question.

Also here are some step by step guides how to install and configure remote database. I would say try MySQL first - IMHO it is simpler that PosgreSQL.

Also there are some video guides available on youtube

Upvotes: 2

SingleNegationElimination
SingleNegationElimination

Reputation: 156128

sqlite cannot be used over the network, with login credentials, in the same way you would connect to MySQL or PostgreSQL; the correct connection string to pass to create_engine is just

 engine = create_engine('sqlite:////tmp/nwtopology.db')

Upvotes: 3

Related Questions