sqlite

Get column value if it matches another column value in the same table

独自空忆成欢 提交于 2020-03-05 06:05:14
问题 I have a SQLite table with comments like: Id | replyId | commentID_parentID | usernameChannelId | channelId 1 | NULL | NULL | a | g 2 | NULL | NULL | b | k NULL | 1.k | 1 | a | p NULL | 1.p | 1 | c | i 3 | NULL | NULL | d | h NULL | 2.k | 2 | g | g and a table with channels like: I want to know which user (userChannelId) replied to which user. So I take a row with a comment and check if: Id == NULL? Then it's a reply -> get userChannelId where commentID_parentID == Id Id != NULL? Then it's a

Apply processing or function to column that requires retrieving column from another sqlite table

送分小仙女□ 提交于 2020-03-05 04:41:05
问题 Suppose I have this table name_currency in sqlite3. name, currency, price AA, SGD, 1 BB, USD, 2 CC, EUR, 3 I need to process the price in this manner. if currency == "SGD", price = price*X if currency == "USD", price = price*Y if currency == "EUR", price = price*Z The values of X , Y , Z needs to be retrieved from another table currency_multiplier . This is how currency_multiplier looks like. name, currency, multiplier AA, SGD, 2 #value of X BB, USD, 3 #value of Y CC, EUR, 4 #value of Z The

“Database or disk is full” on VACUUM with plenty of free space

妖精的绣舞 提交于 2020-03-05 03:07:11
问题 I spent an hour scouring the many other threads with this exact problem and trying to apply the solutions, but half the threads say the problem is that the disk is full (it's not), and for the rest, I couldn't understand the answers or they didn't work for me. My db file is 8MB and my SSD has 314GB free. The only other volume is my iCloud Drive which has 237MB free. Other threads suggest changing the volume the temporary directory is on, but: (1) Both my volumes have plenty of free space. (2)

Xamarin/C# - Insert data into SQLite database programmatically for multiple tables?

痞子三分冷 提交于 2020-03-05 02:05:00
问题 My Xamarin app pulls data from an API and inserts that data into a SQLite table. The API currently has 9 tables defined, and as such there are 9 classes in my app that match those tables. I used the code snippet from this question's accepted answer: Getting all types in a namespace via reflection Below is my code, using the snippet from the answer and the foreach loop I'm trying to build that'll insert the data. string nspace = "App.Tables"; var q = from t in Assembly.GetExecutingAssembly()

Xamarin/C# - Insert data into SQLite database programmatically for multiple tables?

余生颓废 提交于 2020-03-05 02:04:43
问题 My Xamarin app pulls data from an API and inserts that data into a SQLite table. The API currently has 9 tables defined, and as such there are 9 classes in my app that match those tables. I used the code snippet from this question's accepted answer: Getting all types in a namespace via reflection Below is my code, using the snippet from the answer and the foreach loop I'm trying to build that'll insert the data. string nspace = "App.Tables"; var q = from t in Assembly.GetExecutingAssembly()

Xamarin/C# - Insert data into SQLite database programmatically for multiple tables?

允我心安 提交于 2020-03-05 02:04:01
问题 My Xamarin app pulls data from an API and inserts that data into a SQLite table. The API currently has 9 tables defined, and as such there are 9 classes in my app that match those tables. I used the code snippet from this question's accepted answer: Getting all types in a namespace via reflection Below is my code, using the snippet from the answer and the foreach loop I'm trying to build that'll insert the data. string nspace = "App.Tables"; var q = from t in Assembly.GetExecutingAssembly()

How can I see which sqlite3 binary does the sqlite3 Python module use on Ubuntu 16.04?

♀尐吖头ヾ 提交于 2020-03-05 01:33:43
问题 How can I see which sqlite3 binary (containing the SQLite relational database management system) does the sqlite3 Python module use on Ubuntu 16.04? I unsuccessfully looked at /usr/lib/python3.7/sqlite3 and https://docs.python.org/3/library/sqlite3.html. I use Python 3.7. The output of python -c "import sqlite3; print(sqlite3.__file__)" is /usr/lib/python3.7/sqlite3/__init__.py 回答1: It's not going to use the sqlite3 executable directly if that's what you're thinking. It's going to be linked

How can I use the FTS5 extension with the sqlite3 python module with Python 3.7?

痴心易碎 提交于 2020-03-05 01:32:51
问题 How can I use the FTS5 extension with the sqlite3 python module with Python 3.7? I tried to run the following code in Python with python testFTS5.py : import sqlite3 conn = sqlite.connect('some_db.db') sqlite.enable_load_extension(True) sqlite.load_extension('fts5') which results in the error message: Traceback (most recent call last): File "./src/test.py", line 3, in <module> sqlite.enable_load_extension(True) AttributeError: module 'sqlite3' has no attribute 'enable_load_extension' I tried

How can I use the FTS5 extension with the sqlite3 python module with Python 3.7?

荒凉一梦 提交于 2020-03-05 01:32:17
问题 How can I use the FTS5 extension with the sqlite3 python module with Python 3.7? I tried to run the following code in Python with python testFTS5.py : import sqlite3 conn = sqlite.connect('some_db.db') sqlite.enable_load_extension(True) sqlite.load_extension('fts5') which results in the error message: Traceback (most recent call last): File "./src/test.py", line 3, in <module> sqlite.enable_load_extension(True) AttributeError: module 'sqlite3' has no attribute 'enable_load_extension' I tried

How can I see which sqlite3 binary does the sqlite3 Python module use on Ubuntu 16.04?

戏子无情 提交于 2020-03-05 01:31:32
问题 How can I see which sqlite3 binary (containing the SQLite relational database management system) does the sqlite3 Python module use on Ubuntu 16.04? I unsuccessfully looked at /usr/lib/python3.7/sqlite3 and https://docs.python.org/3/library/sqlite3.html. I use Python 3.7. The output of python -c "import sqlite3; print(sqlite3.__file__)" is /usr/lib/python3.7/sqlite3/__init__.py 回答1: It's not going to use the sqlite3 executable directly if that's what you're thinking. It's going to be linked