sqlite

How to start afresh with a new database in Django?

放肆的年华 提交于 2020-01-23 17:41:33
问题 I deleted my database. I want to start afresh with a new database. How can I do that ? I tried making a new datasource but it gives me an error while applying migrations/or migrating that it couldn't find the tables? Which is true because its an empty database. A similar scenario would be when some one pulls a version of my code. He wouldn't have migrations or the database (untracked). How would he run the application? 回答1: Delete all the folders named 'migrations'. And go to terminal and run

How to insert same value to entire column in sqlite3?

半城伤御伤魂 提交于 2020-01-23 10:45:08
问题 I need to insert a text to entire column in the table .column is having 200 rows .i need to insert the same value into entire 200 rows of the same column...how to do this help me...thanks in advance. 回答1: UPDATE `Table` SET `Column` = 'value' Just with no WHERE clause 来源: https://stackoverflow.com/questions/6728738/how-to-insert-same-value-to-entire-column-in-sqlite3

Split comma-separated values and map them to original ID in SQLite

时光怂恿深爱的人放手 提交于 2020-01-23 09:54:30
问题 I have a table called articles that contains data in the following format: id|categories --+---------- 1|123,13,43 2|1,3,15 3|9,17,44,18,3 For testing purposes, you may create this table using the following SQL commands: CREATE TABLE articles(id INTEGER PRIMARY KEY, categories TEXT); INSERT INTO articles VALUES(1, '123,13,43'), (2, '1,3,15'), (3, '9,17,44,18,3'); Now I would like to split the values of the categories column so that a table like the following one is the result: id|category --+

getDatabase called recursively when insert a record in oCreate of my DbHelper class

孤街醉人 提交于 2020-01-23 08:24:06
问题 When I'm trying to insert a record in onCreate method of my DbHelper class which is extended from SQLiteOpenHelper, this error will be rised. I've found some similar topics like these: Android getDatabase called recursively getWritableDatabase called recursively getDatabase called recursively but these are not going to help me. public class DbHelper extends SQLiteOpenHelper{ public int x=0; public DbHelper(Context context) { super(context, "shareholders.db", null, 1); } @Override public void

Pure Python Backup of SQLite3 In-Memory Database to Disk

前提是你 提交于 2020-01-23 08:05:27
问题 Without installing additional modules, how can I use the SQLite backup API to backup an in-memory database to an on-disk database? I have managed to successfully perform a disk-to-disk backup, but passing the already-extant in-memory connection to the sqlite3_backup_init function appears to be the problem. My toy example, adapted from https://gist.github.com/achimnol/3021995 and cut down to the minimum, is as follows: import sqlite3 import ctypes # Create a junk in-memory database sourceconn

Pure Python Backup of SQLite3 In-Memory Database to Disk

时间秒杀一切 提交于 2020-01-23 08:05:06
问题 Without installing additional modules, how can I use the SQLite backup API to backup an in-memory database to an on-disk database? I have managed to successfully perform a disk-to-disk backup, but passing the already-extant in-memory connection to the sqlite3_backup_init function appears to be the problem. My toy example, adapted from https://gist.github.com/achimnol/3021995 and cut down to the minimum, is as follows: import sqlite3 import ctypes # Create a junk in-memory database sourceconn

How to use SQLite database from MS Access?

亡梦爱人 提交于 2020-01-23 05:48:06
问题 I would like to use an SQLite database from Microsoft Access (access from- or transfer the contents to Microsoft Access). How can this be done using VBA? This is for a client who can not install extra software: Does a library exist in VBA to use SQLite databases? 回答1: If you can use the sqlite3.exe command line tool, then have VBA spawn that and dump the data to a csv file. Then Access can read both local data and the CSV file and copy appropriately. 回答2: Does a standard library exist in VBA

Change decimal separator (Python, Sqlite, Pandas)

眉间皱痕 提交于 2020-01-23 04:11:13
问题 I have an Excel spreadsheet (which is an extract from SAP) which has data in it (text, numbers). I turn this data into a DataFrame, do some calculations and finally save it to a sqlite database. Whereas the excel spreadsheet has a comma as the decimal separator. The sqlite database includes the numbers with a dot as the decimal separator. Extract from the code: df_mce3 = pd.read_excel('rawdata/filename.xlsx', header=0, converters={'supplier': str, 'month': str}, decimal=',') (decimal=',' was

Change decimal separator (Python, Sqlite, Pandas)

纵然是瞬间 提交于 2020-01-23 04:11:09
问题 I have an Excel spreadsheet (which is an extract from SAP) which has data in it (text, numbers). I turn this data into a DataFrame, do some calculations and finally save it to a sqlite database. Whereas the excel spreadsheet has a comma as the decimal separator. The sqlite database includes the numbers with a dot as the decimal separator. Extract from the code: df_mce3 = pd.read_excel('rawdata/filename.xlsx', header=0, converters={'supplier': str, 'month': str}, decimal=',') (decimal=',' was

How do I make pyinstaller include my database?

[亡魂溺海] 提交于 2020-01-23 03:16:05
问题 I've got a PyQt4 application which makes use of sqlite3. I have two seperate files currently: a .py file and a .db file. Originally I took the .py file and tried to create an executable just using that thinking maybe it would link somehow but when I run the .exe it breaks when it gets to database related code. How do I get pyinstaller to include the database as well? 回答1: You need to use a specfile. Have a look at the documentation. pyinstaller creates those file automatically. You just need