mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-08 12:13:51 +08:00
MAINT: Consolidate coercion to sqlite conn/eng
This commit is contained in:
@@ -12,9 +12,13 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sqlite3
|
||||
|
||||
import sqlalchemy as sa
|
||||
from six.moves import range
|
||||
|
||||
from .input_validation import coerce_string
|
||||
|
||||
SQLITE_MAX_VARIABLE_NUMBER = 998
|
||||
|
||||
|
||||
@@ -22,3 +26,9 @@ def group_into_chunks(items, chunk_size=SQLITE_MAX_VARIABLE_NUMBER):
|
||||
items = list(items)
|
||||
return [items[x:x+chunk_size]
|
||||
for x in range(0, len(items), chunk_size)]
|
||||
|
||||
|
||||
coerce_string_to_conn = coerce_string(sqlite3.connect)
|
||||
coerce_string_to_eng = coerce_string(
|
||||
lambda s: sa.create_engine('sqlite:///' + s)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user