Save the contents from the OGR DataSource Layer into the database according to the mapping dictionary given at initialization. Keyword Parameters: verbose: If set, information will be printed subsequent to each model save executed on the datab
(
self,
verbose=False,
fid_range=False,
step=False,
progress=False,
silent=False,
stream=sys.stdout,
strict=False,
)
| 558 | ) |
| 559 | |
| 560 | def save( |
| 561 | self, |
| 562 | verbose=False, |
| 563 | fid_range=False, |
| 564 | step=False, |
| 565 | progress=False, |
| 566 | silent=False, |
| 567 | stream=sys.stdout, |
| 568 | strict=False, |
| 569 | ): |
| 570 | """ |
| 571 | Save the contents from the OGR DataSource Layer into the database |
| 572 | according to the mapping dictionary given at initialization. |
| 573 | |
| 574 | Keyword Parameters: |
| 575 | verbose: |
| 576 | If set, information will be printed subsequent to each model save |
| 577 | executed on the database. |
| 578 | |
| 579 | fid_range: |
| 580 | May be set with a slice or tuple of (begin, end) feature ID's to map |
| 581 | from the data source. In other words, this keyword enables the user |
| 582 | to selectively import a subset range of features in the geographic |
| 583 | data source. |
| 584 | |
| 585 | step: |
| 586 | If set with an integer, transactions will occur at every step |
| 587 | interval. For example, if step=1000, a commit would occur after |
| 588 | the 1,000th feature, the 2,000th feature etc. |
| 589 | |
| 590 | progress: |
| 591 | When this keyword is set, status information will be printed giving |
| 592 | the number of features processed and successfully saved. By default, |
| 593 | progress information will pe printed every 1000 features processed, |
| 594 | however, this default may be overridden by setting this keyword with |
| 595 | an integer for the desired interval. |
| 596 | |
| 597 | stream: |
| 598 | Status information will be written to this file handle. Defaults to |
| 599 | using `sys.stdout`, but any object with a `write` method is |
| 600 | supported. |
| 601 | |
| 602 | silent: |
| 603 | By default, non-fatal error notifications are printed to stdout, but |
| 604 | this keyword may be set to disable these notifications. |
| 605 | |
| 606 | strict: |
| 607 | Execution of the model mapping will cease upon the first error |
| 608 | encountered. The default behavior is to attempt to continue. |
| 609 | """ |
| 610 | # Getting the default Feature ID range. |
| 611 | default_range = self.check_fid_range(fid_range) |
| 612 | |
| 613 | # Setting the progress interval, if requested. |
| 614 | if progress: |
| 615 | if progress is True or not isinstance(progress, int): |
| 616 | progress_interval = 1000 |
| 617 | else: |