Python 中的 sqlite3:我可以增加最大连接数吗?
sqlite3 in Python: Can I increase maximum number of connections?
在 Python 中使用 sqlite3
,在我看来,可以建立到 不同 数据库的连接数上限为同时。
例如,我可以连接到 1000 个不同的数据库:
cons = [sqlite3.connect(infile) for infile in infiles[:1000]]
但是打不开
cons = [sqlite3.connect(infile) for infile in infiles[:1024]]
在数据库上给出 sqlite3.OperatinError: unable to open database file
,这些阈值似乎在 1024
左右。
有没有办法将这个最大值增加到大约 4096
?
您可能遇到了每个进程打开文件的最大数量。
如果您使用的是 Linux,请参见例如How do I change the number of open files limit in Linux?
在 Python 中使用 sqlite3
,在我看来,可以建立到 不同 数据库的连接数上限为同时。
例如,我可以连接到 1000 个不同的数据库:
cons = [sqlite3.connect(infile) for infile in infiles[:1000]]
但是打不开
cons = [sqlite3.connect(infile) for infile in infiles[:1024]]
在数据库上给出 sqlite3.OperatinError: unable to open database file
,这些阈值似乎在 1024
左右。
有没有办法将这个最大值增加到大约 4096
?
您可能遇到了每个进程打开文件的最大数量。
如果您使用的是 Linux,请参见例如How do I change the number of open files limit in Linux?