Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

874 changes: 0 additions & 874 deletions poetry.lock

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
"pillow (>=9.0.1,<10.0)",
"django-storages==1.14.*",
"boto3==1.42.*",
"sqlalchemy==1.3.*",
"sqlalchemy==2.0.*",
"geoalchemy2==0.7.*",
]

Expand Down
2 changes: 1 addition & 1 deletion tablo/csv_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def prepare_csv_rows(csv_file, csv_info=None):
if csv_info:
date_fields = get_date_fields(csv_info)
for field in date_fields:
row_set[field] = row_set[field].astype('datetime64')
row_set[field] = row_set[field].astype('datetime64[ns]')

row_set.index += 1
data_types = infer_data_types(row_set)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 5.2.13 on 2026-07-23 18:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("tablo", "0007_update_integer_columns_to_bigint"),
]

operations = [
migrations.AlterField(
model_name="temporaryfile",
name="file",
field=models.FileField(max_length=1024, upload_to="storage/tablo/temp/"),
),
migrations.AlterField(
model_name="temporaryfile",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
27 changes: 17 additions & 10 deletions tablo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import logging
import re
from sqlalchemy import text
import sqlparse
import uuid

Expand Down Expand Up @@ -1055,22 +1056,28 @@ def create_aggregate_database_table(row, dataset_id):
seq_check_query = "SELECT sequence_name FROM information_schema.sequences WHERE sequence_name = '{}'".format(
sequence_name
)
if not conn.execute(seq_check_query).fetchone():
if not conn.execute(text(seq_check_query)).fetchone():
conn.execute(
'CREATE SEQUENCE {sequence} OWNED BY {table_name}.{pk}'.format(
sequence=sequence_name,
table_name=table_name,
pk=PRIMARY_KEY_NAME
text(
"CREATE SEQUENCE {sequence} OWNED BY {table_name}.{pk}".format(
sequence=sequence_name,
table_name=table_name,
pk=PRIMARY_KEY_NAME,
)
)
)
conn.execute(
'ALTER TABLE {table} ALTER COLUMN {key} TYPE bigint USING {key}::bigint'.format(
table=table_name, key=PRIMARY_KEY_NAME
text(
"ALTER TABLE {table} ALTER COLUMN {key} TYPE bigint USING {key}::bigint".format(
table=table_name, key=PRIMARY_KEY_NAME
)
)
)
conn.execute(
'ALTER TABLE {table} ALTER COLUMN {key} SET DEFAULT nextval(\'{sequence}\')'.format(
table=table_name, key=PRIMARY_KEY_NAME, sequence=sequence_name
text(
"ALTER TABLE {table} ALTER COLUMN {key} SET DEFAULT nextval('{sequence}')".format(
table=table_name, key=PRIMARY_KEY_NAME, sequence=sequence_name
)
)
)
return table_name
Expand Down Expand Up @@ -1113,7 +1120,7 @@ def create_database_table(row_set, csv_info, dataset_id, append=False, additiona
if c not in csv_info['optionalFields']:
constraints_query.append('ALTER COLUMN {} SET NOT NULL'.format(c))
constraints_query = 'ALTER TABLE {} {}'.format(table_name, ','.join(constraints_query))
conn.execute(constraints_query)
conn.execute(text(constraints_query))

return table_name

Expand Down
7 changes: 6 additions & 1 deletion tablo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ def get_sqlalchemy_engine():
db_auth = ''
db_host = settings['HOST']
db_name = settings['NAME']
return create_engine('postgresql://{auth}{host}/{name}'.format(auth=db_auth, host=db_host, name=db_name))
db_port = settings.get("PORT", "5432")
return create_engine(
"postgresql://{auth}{host}:{port}/{name}".format(
auth=db_auth, host=db_host, name=db_name, port=db_port
)
)


def dictfetchall(cursor):
Expand Down
45 changes: 42 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.