Well now that is embarrassing. Thanks!
For reference, this was my recipe to put at the top of a file that is going
to populate multiple tables:
if db(db.auth_user).count() == 0:
#Bulk load account
admin_user_id = db.auth_user.insert(first_name='Bulk uploader')
else:
admin_user_id = d
Did you try...
db.locations.created_by.default = 1 # or
whateverdb.locations.modified_by.update = 1
prior to: import_from_csv_file
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issu
Thanks for your help!
Il giorno mercoledì 13 gennaio 2016 16:38:12 UTC+1, Anthony ha scritto:
>
> I think you'll have to manually change the column names in the file,
> either by hand or via Python code.
>
> Anthony
>
> On Wednesday, January 13, 2016 at 7:33:20 AM UTC-5, goome wrote:
>>
>> Hi
>>
I think you'll have to manually change the column names in the file, either
by hand or via Python code.
Anthony
On Wednesday, January 13, 2016 at 7:33:20 AM UTC-5, goome wrote:
>
> Hi
> i created i table definition in db.py by using csvstudio.py, but i cannot
> load the values through db.table.
Thank you
2016-01-11 20:25 GMT+01:00, Anthony :
> db.mytable.import_from_csv(..., unique='my_unique_column')
>
> will do an update instead of an insert if the value of the
> "my_unique_column" field matches that of an existing record in the
> database.
>
> Anthony
>
> On Monday, January 11, 20
db.mytable.import_from_csv(..., unique='my_unique_column')
will do an update instead of an insert if the value of the
"my_unique_column" field matches that of an existing record in the database.
Anthony
On Monday, January 11, 2016 at 12:07:55 PM UTC-5, goome wrote:
>
> hi
> Does import_from_csv
yes
On Tuesday, 25 August 2015 18:02:40 UTC-5, Mark Li wrote:
>
> Is id_map still necessary to preserver references when using
> import_form_csv_file function?
>
> I read this in the docs (
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV--all-tables-at-once-
> )
Is id_map still necessary to preserver references when using
import_form_csv_file function?
I read this in the docs (
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV--all-tables-at-once-
):
"When importing, the new records will be appended to the database if it i
Thanks.
I will try to make some time and contribute in that way.
Note:
You may want to update the link to your profile
on http://web2py.com/init/default/who
--> it results in a page not found.
Best regards,
Tom.
On Wednesday, March 11, 2015 at 7:07:04 PM UTC+1, Tom Clerckx wrote:
>
> I recentl
I agree.
The problem is lack of manpower. If you send me a paragraph I will include
it in the docs.
On Wednesday, 11 March 2015 13:07:04 UTC-5, Tom Clerckx wrote:
>
> I recently learned (by searching through the google-group) the usefulness
> of the id_map={} parameter in the db.import_from_csv
I think it should, but I'm assuming that's not how it is in practice.
On Thursday, August 28, 2014 11:55:26 PM UTC-7, lyn2py wrote:
>
> Thanks Derek. If the "uuid" field were specified, shouldn't the specified
> field be used, the way a uuid field is used, to de-duplicate records?
--
Resources:
Thanks Derek. If the "uuid" field were specified, shouldn't the specified field
be used, the way a uuid field is used, to de-duplicate records?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/w
>From the documentation:
When importing, the new records will be appended to the database if it is
not empty. In general the new imported records will not have the same
record id as the original (saved) records but web2py will restore
references so they are not broken, even if the id values may
book say this.
db.person.import_from_csv_file(open('test.csv', 'r'))
why do you use a different syntax ?
BTW: you'd need to delete the table first, or you'll append to existent
records in the database the ones in the csv file.
On Wednesday, June 20, 2012 3:55:26 PM UTC+2, joe wrote:
>
> I w
not sure if there is a difference in the resulting file, but I usually
use db.category.export_to_csv_file(open(...))
On Feb 16, 3:24 pm, Richard Penman wrote:
> I exported a table from sqlite with:
> open(filename, 'w').write(str(db(db.category.id).select()))
>
> Output file looks as expected.
>
Looked in the DAL section of the manual, looks like you need to open the
file and supply the File object as the parameter to
db.table.import_from_csv(...)
You can serialize a single table in CSV and store it in a file "test.csv":
1.
>>> open('test.csv', 'w').write(str(db(db.person.id).select(
did it from controller.
And not a rollback because the data was inserted, just the fields are NULL.
On Thu, Feb 16, 2012 at 4:52 PM, Ron McOuat wrote:
> If you did this from a shell using the -S and -M web2py.py options then
> the code must do a db.commit() as part of the program flow. A reques
If you did this from a shell using the -S and -M web2py.py options then the
code must do a db.commit() as part of the program flow. A request through
the web server has commit and rollback operations embedded in the request
processing transaction management.
Ron
I'm interested to learn the answer to this -I tried to export from
SQLite and import into a MySQL database, but the references got messed
up no matter what I tried...
On Nov 22, 4:36 am, David Manns wrote:
> In my application which is hosted on GAE I have backup/restore
> functions which use expo
A little something like this I use a much more complex version of
this for migration.
open csv
records = dict()
for line in csv:
parse if new table if yes continue
parse table field names if yes continue
if tablename == 'asdf':
asdf = line but [delete id, set reference records t
This is a good idea. This could also be used to fix 'list:reference'
On Sep 26, 1:26 am, Thadeus Burgess wrote:
> Write a custom csv importer. use the code in gluon as an example for parsing.
>
> During the initial import, set the reference to None. While importing,
> keep a dictionary in memory
Write a custom csv importer. use the code in gluon as an example for parsing.
During the initial import, set the reference to None. While importing,
keep a dictionary in memory that can hold all needed references to a
record. After import, commit, and then go through your dictionary
fixing all of
There is no way to do this. When you import the first record, the
second does not exist yet therefore the reference cannot be adjusted
by web2py. This is why self references are never a good idea. Use a
link table instead.
On Sep 25, 2:19 pm, Jurgis Pralgauskis
wrote:
> Hello,
>
> I have Topics T
23 matches
Mail list logo