Skip to content

Commit 596f9fc

Browse files
d33bsbethac07
andauthored
Reconcile v0.3.5 with changes in branch 0.3.4 (#135)
* Move database connection from `into` to `seed`, close connection * Update setup.py * Update setup.cfg * Update conf.py * Update setup.py * bump cfg version * formatting --------- Co-authored-by: Beth Cimini <[email protected]>
1 parent a138e95 commit 596f9fc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

cytominer_database/ingest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import tempfile
4848
import sqlalchemy.exc
4949
from sqlalchemy import create_engine
50+
from sqlalchemy.pool import NullPool
5051

5152
import cytominer_database.utils
5253

@@ -58,7 +59,7 @@ def __format__(name, header):
5859
return "{}_{}".format(name, header)
5960

6061

61-
def into(input, output, name, identifier, skip_table_prefix=False):
62+
def into(input, output, name, identifier, con, skip_table_prefix=False):
6263
"""Ingest a CSV file into a table in a database.
6364
6465
:param input: Input CSV file.
@@ -132,6 +133,9 @@ def seed(source, target, config_path, skip_image_prefix=True):
132133
# list the subdirectories that contain CSV files
133134
directories = sorted(list(cytominer_database.utils.find_directories(source)))
134135

136+
engine = create_engine(target, poolclass=NullPool)
137+
con = engine.connect()
138+
135139
for directory in directories:
136140
# get the image CSV and the CSVs for each of the compartments
137141
try:
@@ -158,7 +162,8 @@ def seed(source, target, config_path, skip_image_prefix=True):
158162
output=target,
159163
name=name.capitalize(),
160164
identifier=identifier,
161-
skip_table_prefix=skip_image_prefix,
165+
con=con,
166+
skip_table_prefix=skip_image_prefix
162167
)
163168
except sqlalchemy.exc.DatabaseError as e:
164169
click.echo(e)
@@ -173,4 +178,6 @@ def seed(source, target, config_path, skip_image_prefix=True):
173178
output=target,
174179
name=name.capitalize(),
175180
identifier=identifier,
181+
con=con
176182
)
183+
con.close()

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ testpaths =
1111

1212
[build_sphinx]
1313
project = 'cytominer_database'
14-
version = 0.3.3
14+
version = 0.3.5

0 commit comments

Comments
 (0)